i always try the problem for 1-1.5hrs before watching your solutions .................... i respect that you always keep reminding people to try the problem on their own.......Thanks a lot bhaiya for such awsome videos...
Bhaiya i respect that you always keep reminding people to try the problem on their own, and i always try the problem for 1-1.5hrs before watching your solutions
Bhai I m confuse I have abdul bari dsa videos and coding ninja c++ dsa videos and sometimes watch love babbar videos as well as ur videos also but not ale to choose where i have to learn
I attempted this on my own but i think there is slight error in my code , This is the code i wrote bool isValid(int i, int j, int n, int m, vector& board){ if (i>=0 and i=0 and j
bhaiya bfs wala class Solution { public: void solve(vector& board) { int n = board.size(); int m = board[0].size(); vector image(n, vector(m, 0)); queue q;
for (int i = 0; i < m; i++) { if (board[0][i] == 'O') { q.push({0, i}); image[0][i] = 1; } }
for (int i = 0; i < n; i++) { if (board[i][0] == 'O') { q.push({i, 0}); image[i][0] = 1; } }
for (int i = 0; i < m; i++) { if (board[n-1][i] == 'O') { q.push({n-1, i}); image[n-1][i] = 1; } }
for (int i = 0; i < n; i++) { if (board[i][m-1] == 'O') { q.push({i, m-1}); image[i][m-1] = 1; } }
int delrow[] = {-1, 0, 1, 0}; int delcol[] = {0, -1, 0, 1};
while (!q.empty()) { int row = q.front().first; int col = q.front().second; q.pop();
for (int i = 0; i < 4; i++) { int nrow = row + delrow[i]; int ncol = col + delcol[i];
My solution :-> class Solution { public: void dfs(int i,int j,int n,int m,vector& board,vector&vis){ if(i=m || vis[i][j]==1 || board[i][j]=='X'){ return; } vis[i][j]=1; dfs(i+1,j,n,m,board,vis); dfs(i,j+1,n,m,board,vis); dfs(i-1,j,n,m,board,vis); dfs(i,j-1,n,m,board,vis); } void solve(vector& board) { //convert all those zeroes to x which are not a part of boundary region int n=board.size(),m=board[0].size(); vectorvis(n+1,vector(m+1,0)); for(int i=0;i
----------------------------------------------------------------CODE----------------------------------------------------------------------------- class Solution { public: bool isValid(int i, int j, vector& board) { int m = board.size(); int n = board[0].size();
i always try the problem for 1-1.5hrs before watching your solutions
.................... i respect that you always keep reminding people to try the problem on their own.......Thanks a lot bhaiya for such awsome videos...
Thanks bhai
Bhaiya i respect that you always keep reminding people to try the problem on their own, and i always try the problem for 1-1.5hrs before watching your solutions
Thanks a ton for this positive words
Please, share this channel in your college, groups, or LinkedIn bcoz it's cost nothing to you 😀
Thanks, done without seeing the solution code, Explanation was enough, 🌹
Wah kya code likha hai, ❤ Modular, clean, just gr8, perfectly understood.
😍 Thanks a lot
very easy explanation (1 bar me samajh me aa gya👌👌)
pyaara smjhaya thanku bhai
Waaah bhaiyaaa ULTIMATE, mazaaa aa gyaaa...
Thanks a ton 😀
can you explain the time and space complexity of each solution after giving the solution
Very nicely explained, Thanks a lot!
u are so self-less, always thinking of the benefit of students
Thanks Adarsh
Please, share this channel in your college, groups, or LinkedIn bcoz it's cost nothing to you 😀
Bahut hi OP approach , mazza agaya
Best Explanation For Boundary Traversal... Thanks
Thanks yaar
Easy solution!Btw thanks for concept!
Most welcome 😊
I tried different approach but this approach is EXCELLENT 😂🎉
Glad you liked it!
I always follow your tips.😇😇
Thanks 🙏
time complexity jyaada hai bro but iski like boundary aur fir andar ka . btw nice explanation .
superb explanation brother thank you
Good one, boundary DFS, catchy name as well to remember.
yesss
Amazing explanation sir.
Thanks Anjali
Good explanation
very great explanation....
Glad it was helpful!
clear crisp
Great vid!😀
Thanks! 😁
thanks
If there ie a O at boundary-1 ..how are we dealing with that ...
dfs
Bhai I m confuse I have abdul bari dsa videos and coding ninja c++ dsa videos and sometimes watch love babbar videos as well as ur videos also but not ale to choose where i have to learn
😅😅
You have lots of resources buddy
Aap aise socho ki ...at the end aapse questions hone chahiye
Wo kaha se padhkar ho raha hai ....
Ye dekho aap
shaktiman hi gangadhar hai!!! graoh br like.
best trick.....
Yeah Thanks
I attempted this on my own but i think there is slight error in my code ,
This is the code i wrote
bool isValid(int i, int j, int n, int m, vector& board){
if (i>=0 and i=0 and j
class Solution {
public:
bool isValid(int i, int j, vector& board)
{
int m = board.size();
int n = board[0].size();
if(i>=0 && i=0 && j
class Solution {
public void solve(char[][] board) {
boolean[][]vis=new boolean[board.length][board[0].length];
for(int i=0;i
bhaiya bfs wala
class Solution {
public:
void solve(vector& board) {
int n = board.size();
int m = board[0].size();
vector image(n, vector(m, 0));
queue q;
for (int i = 0; i < m; i++) {
if (board[0][i] == 'O') {
q.push({0, i});
image[0][i] = 1;
}
}
for (int i = 0; i < n; i++) {
if (board[i][0] == 'O') {
q.push({i, 0});
image[i][0] = 1;
}
}
for (int i = 0; i < m; i++) {
if (board[n-1][i] == 'O') {
q.push({n-1, i});
image[n-1][i] = 1;
}
}
for (int i = 0; i < n; i++) {
if (board[i][m-1] == 'O') {
q.push({i, m-1});
image[i][m-1] = 1;
}
}
int delrow[] = {-1, 0, 1, 0};
int delcol[] = {0, -1, 0, 1};
while (!q.empty()) {
int row = q.front().first;
int col = q.front().second;
q.pop();
for (int i = 0; i < 4; i++) {
int nrow = row + delrow[i];
int ncol = col + delcol[i];
if (nrow >= 0 && ncol >= 0 && nrow < n && ncol < m && image[nrow][ncol] != 1 && board[nrow][ncol] == 'O') {
q.push({nrow, ncol});
image[nrow][ncol] = 1;
}
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (board[i][j] == 'O' && image[i][j] != 1) {
board[i][j] = 'X';
}
}
}
}
};
good job
My solution :->
class Solution {
public:
void dfs(int i,int j,int n,int m,vector& board,vector&vis){
if(i=m || vis[i][j]==1 || board[i][j]=='X'){
return;
}
vis[i][j]=1;
dfs(i+1,j,n,m,board,vis);
dfs(i,j+1,n,m,board,vis);
dfs(i-1,j,n,m,board,vis);
dfs(i,j-1,n,m,board,vis);
}
void solve(vector& board) {
//convert all those zeroes to x which are not a part of boundary region
int n=board.size(),m=board[0].size();
vectorvis(n+1,vector(m+1,0));
for(int i=0;i
Able to solelve it
But in 10 attempts.😂
😁 nice
22/32 done (19.8.22)
nice
----------------------------------------------------------------CODE-----------------------------------------------------------------------------
class Solution {
public:
bool isValid(int i, int j, vector& board)
{
int m = board.size();
int n = board[0].size();
if(i>=0 && i=0 && j
ye th0 bawasir hai......c0de |ikha hai ya textb00k ka chapter
this code is giving runtime error
@@rachnamalik7605 try to submit on Leetcode, yes it can be optimize....