We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
for (int i = 0; i < board.size()-1; i++) {
List<Integer> row = board.get(i);
List<Integer> col1 = board.get(i+1);
int col=0;
for (int k = 1; k < row.size(); k++) {
int val = row.get(k);
if(val==row.get(col)) {
return "No";
}
else {
col++;
}
}
for (int k = 0; k < row.size(); k++) {
int val1=col1.get(k);
int val = row.get(k);
if(val==val1) {
return "No";
}
}
}
return "Yes";
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Customized Chess Board
You are viewing a single comment's thread. Return to all comments →
static String solve(List> board) {