public boolean check(int [] locations, int row, int clom) {
        for (int i=0; i<row; i++) {
            if (locations[i] == clom) return false;
            if (locations[i]+i == row+clom) return false;
            if (i-locations[i] == row-clom) return false;
        }

        return true;
    }