Розмір відео: 1280 X 720853 X 480640 X 360
Показувати елементи керування програвачем
Автоматичне відтворення
Автоповтор
ohh wow straight abd understandable and clear code no mess
thank you Very good explanation😊, we need more videos
Thank you, I will
Daarun hyeche dada ❤️❤️
thank you
Very good explanation !!
Very good explanation😊
Super explanation brother thanks❤🙏
Welcome 👍
Welcome back buddy
Thank you
can you provide of N-queen problem video ppt..please if possible
thank you so much bro
Bro how to master dsa please provide me roadmap and resources
there is no other option than practice...
Tell explanation that how they can't get attacked
Solution for the leetcode problem:(I removed the row check loop) class Solution { public boolean isSafe(char[][] chessBoard, int row , int column, int n) { for(int i = 0; i < row; i++){ if(chessBoard[i][column] == 'Q') return false; } for(int i = row - 1 ,j = column - 1 ; i >=0 && j>=0;i-- , j--){ if(chessBoard[i][j] == 'Q') return false; } for(int i = row - 1 ,j = column + 1 ; i >=0 && j < n;i-- , j++){ if(chessBoard[i][j] == 'Q') return false; } return true; } public List constructBoard(char[][] chessBoard,int n){ List Board = new ArrayList(); for(int i = 0; i < n; i++){ Board.add(new String(chessBoard[i])); } return Board; } public List solveNQueens(int n) { List result = new ArrayList(); char[][] chessBoard = new char[n][n]; for(int i = 0; i < n; i++){ Arrays.fill(chessBoard[i] , '.'); } solve(0, chessBoard, result, n); return result; } public void solve(int row, char[][] chessBoard , List result, int n ){ if (row == n) { result.add(constructBoard(chessBoard, n)); return; } for(int column = 0; column < n; column++){ if(isSafe(chessBoard, row, column, n)){ chessBoard[row][column] = 'Q'; solve(row + 1, chessBoard, result, n); chessBoard[row][column] = '.'; } } }}
❤❤❤
ohh wow straight abd understandable and clear code no mess
thank you Very good explanation😊, we need more videos
Thank you, I will
Daarun hyeche dada ❤️❤️
thank you
Very good explanation !!
Very good explanation😊
Super explanation brother thanks❤🙏
Welcome 👍
Welcome back buddy
Thank you
can you provide of N-queen problem video ppt..please if possible
thank you so much bro
Bro how to master dsa please provide me roadmap and resources
there is no other option than practice...
Tell explanation that how they can't get attacked
Solution for the leetcode problem:(I removed the row check loop) class Solution {
public boolean isSafe(char[][] chessBoard, int row , int column, int n) {
for(int i = 0; i < row; i++){
if(chessBoard[i][column] == 'Q') return false;
}
for(int i = row - 1 ,j = column - 1 ; i >=0 && j>=0;i-- , j--){
if(chessBoard[i][j] == 'Q') return false;
}
for(int i = row - 1 ,j = column + 1 ; i >=0 && j < n;i-- , j++){
if(chessBoard[i][j] == 'Q') return false;
}
return true;
}
public List constructBoard(char[][] chessBoard,int n){
List Board = new ArrayList();
for(int i = 0; i < n; i++){
Board.add(new String(chessBoard[i]));
}
return Board;
}
public List solveNQueens(int n) {
List result = new ArrayList();
char[][] chessBoard = new char[n][n];
for(int i = 0; i < n; i++){
Arrays.fill(chessBoard[i] , '.');
}
solve(0, chessBoard, result, n);
return result;
}
public void solve(int row, char[][] chessBoard , List result, int n ){
if (row == n) {
result.add(constructBoard(chessBoard, n));
return;
}
for(int column = 0; column < n; column++){
if(isSafe(chessBoard, row, column, n)){
chessBoard[row][column] = 'Q';
solve(row + 1, chessBoard, result, n);
chessBoard[row][column] = '.';
}
}
}
}
❤❤❤