No teacher is present currently who can explain this topic in easy manner amazing job
@Pepcoding4 жыл бұрын
I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem. If you like my efforts, I request a review g.page/Pepcoding/review?rc
@jerichocasey20783 жыл бұрын
InstaBlaster.
@047gauravkumartiwari52 жыл бұрын
@@Pepcoding Ye baat copy pasted message ke form mein hi kyun likhna. Kabhi normally bhi bol diya karo
@ashutoshkumar40993 жыл бұрын
sir no other teacher has the guts to analyze recursive programs completely step by step and draw state space tree for it...Iam really getting to know how to approach solving recursive programs...words fell short thanking you...please keep the good work going
@Pepcoding3 жыл бұрын
Glad to know that you liked the content and thank you for appreciating. The love and respect which I get from you people keep me highly motivated and the same I am able to forward It to you people through my videos. So, keep motivating, keep learning and keep loving Pepcoding😊
@secularguy________2 ай бұрын
@@Pepcoding love u sir
@rohanjaiswal643 жыл бұрын
I watched it twice and the more I watch it ,the more I understand about the working of the Euler. Amazing explanation!!
@Pepcoding3 жыл бұрын
Thankyou beta! I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem. If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
@AHMED_MOCHI3 ай бұрын
After watching 15 videos regarding N Queen problem, no one was able to deliver this concept this easily as you did sir. Thank you so much !
@adityagupta3753 жыл бұрын
At 10:00 he's speaking the language of the gods 🥺🥺😍😍 amazing explanation sir
@adityagupta22533 жыл бұрын
I was stuck in implementation of isSafe method and your tutorial helped me to understand that. Thanks a lot for the clear explanation.
@Pepcoding3 жыл бұрын
Thankyou beta, I am glad you liked it. I also hope that you are watching till end. Will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms)
@ashutoshtiwari47193 жыл бұрын
Still if u didn't get the problem then no one on this planet can teach you better than this ❤️
@Pepcoding3 жыл бұрын
I am glad. Keep learning. Keep supporting. Your kind words are the kind of motivation that truly help me in making more and more content. Especially, these days, not everybody is generous with motivating anybody either. It means a lot
@rupinderkaur-dj8ib3 жыл бұрын
next level teaching,although ive paid for the course(gtbit program) still i watch your videos instead of attending zoom classes.
@Pepcoding3 жыл бұрын
Beta, class zrur attend kre because standalone videos itni benificial nh hoti, jitna live classes hoti h.
@deepakojha32163 жыл бұрын
hi bro can i contact you to know how is live programs can you provide me your instagram id so that i can contact you
@MusicalLifeViB2 жыл бұрын
I had been facing problem in recursion and backtracking but I watched this playlist and now do feel confident to atleast approach the problem. Thanks for this world class explanation and analysis.
@Pepcoding2 жыл бұрын
Glad you liked it! Keep learning. And for better experience, visit nados.io, where you will get well curated content and career opportunities.
@MusicalLifeViB2 жыл бұрын
@@Pepcoding sure and thanks again!
@mayur_madhwani033 жыл бұрын
3 mahine pehle jab pehli baar attempt ki thi ye problem laga tha kabhi solve nahi kar punga. Aaj jab ye video dekha kaafi jaldi solve ho gayi. Thank you for teaching in the best way. Belated Happy Teacher's Day sir ❤
@ZSHADOW182 жыл бұрын
Why is prints all possible solutions can anyone explain, i mean it should just print the first possible solution but instead the code prints all possible solutions...
@karakib2k172 жыл бұрын
Thank you from Bangladesh. Amazing video. I love your explanation and dry run system.
@creativegiant1483 жыл бұрын
No teacher is as dedicated as him to make us understand the topic please guys subscribe the channel he is great
@Pepcoding3 жыл бұрын
Thanks buddy! Always keep supporting and loving like this.
@nknidhi3213 жыл бұрын
Never thought N-Queen would be this easy.. All credits to you..🙏❤️
@Pepcoding3 жыл бұрын
Will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
@shubhamkhuntia24122 жыл бұрын
lelo sir anumati, aap h rkhiye unko. aaajse Anumati aapki
@debbh2742 жыл бұрын
Man, the clarity of your explanations is mind boggling.
@prakhar_kesar3 жыл бұрын
Probably the best explanation of N-Queens Ever. #Respect.
@nitin90423 жыл бұрын
Student at someother x academy learning from pepcoding thats how much good he is
@krishnapandit_vlogs2 жыл бұрын
Lajaawab explanation sir ji.... Excellent job... I am your big fan sir ji....
@chandanverma51792 жыл бұрын
Sir this may sound stupid but why didn't you solved this like expectation faith Meet expectation from faith .. Can we not solve this like that????
@RBNrocks9 ай бұрын
Sir thanks a lot for explaining in so much details. I think if you also explain the time complexity and space complexity of the final solution, it would be helpful.
@jatinbhatoya84203 жыл бұрын
leetcode 51 static List finalAns; public static List solveNQueens(int n) { int arr[][] = new int[n][n]; finalAns = new ArrayList(); printNQueens(arr, "", 0); return finalAns; } public static boolean isItSafePlaceForQueen(int arr[][], int row, int col) { // CHECK IN ABOVE COLUMNS for (int i = row - 1, j = col; i >= 0 && j >= 0; i--) { if (arr[i][j] == 1) return false; } // CHECK DIAGONALLY ON LEFT for (int i = row - 1, j = col - 1; i >= 0 && j >= 0; i--, j--) { if (arr[i][j] == 1) return false; } // CHECK DIAGONALLY ON RIGHT for (int i = row - 1, j = col + 1; i >= 0 && j < arr[0].length; i--, j++) { if (arr[i][j] == 1) return false; } return true; } public static void printNQueens(int arr[][], String qsf, int row) { if (row == arr.length) { // System.out.println(qsf); List ans = new ArrayList(); for (int i = 0; i < arr.length; i++) { String st=""; for (int j = 0; j < arr[0].length; j++) { if (arr[i][j] == 1) { st+="Q"; } else { st+="."; } } ans.add(st); } finalAns.add(ans); return ; } for (int i = 0; i < arr[0].length; i++) { if (isItSafePlaceForQueen(arr, row, i)) { arr[row][i] = 1; printNQueens(arr, qsf+row+" - "+i+" , ", row + 1); arr[row][i] = 0; } } }
@SumitKumar-sx1oi10 ай бұрын
for 3 output shouldn't be blank , output should be (0,0) -(1,2)
@parasrawat93213 жыл бұрын
i did it in c++ with my logic: #include #include #define max 100 using namespace std; int chess[max][max]={0}; bool saferow(int r, int c ,int n){ for(int i=0 ; i=0) { if(chess[r1][c1]==1) return false; c1--; r1--; } r1=r , c1=c; while(c1=0) { if(chess[r1][c1]==1) return false; c1++; r1--; } return true; } void queens(int r, int c, int n, string op) { if(r>=n) { cout
@abhishekranjan10942 жыл бұрын
Thank you so much sumit sir... #leetcode solution class Solution { List finalList ; public List solveNQueens(int n) { int[][] queen= new int[n][n] ; finalList=new ArrayList() ; printQueen(queen,0) ; return finalList ; } public void printQueen(int[][] queen , int row ){ if(row==queen.length){ List ans = new ArrayList() ; for(int i=0 ; i=0 ; i--, j--){ // left diagonal if(queen[i][j]==1){ return false ; } } return true ; } }
@faizanhaider3953 Жыл бұрын
Sir mujhe to lagta h X academy aur bhi jo platform hai... Sb aap se parh k tahalKaa macha rahe honGai aur alag se jaa k phokat me u6al rahe hai 😂😂 BTW explanation is on Baap Level... Thanks q so much sir
@gurpreetsodi39485 ай бұрын
I watched many videos, but for understanding code this is best.
@prernnajain15322 жыл бұрын
Sir I'm getting stack overflow error .. please help mee😭
@lochan472 ай бұрын
10:30 I am just leaving the time stamp for myself, so other please ignore.
@rithikraj18133 жыл бұрын
But apne recursion pdhaya aacha h puri series follow krri but vo flood fill wala ghaph mei batana chahiye tha 1st yr wale darr jaayenge 😂😂
@ShMayank Жыл бұрын
Initially when the queens were placed randomly, I was a bit confused as to why it was being done but when the condition to check for safe place was added, it made so much sense and the solution became super easy. Can't thank this channel enough, really
@kunalvaishnav9283 Жыл бұрын
thankyou no one explained recursive tree you are the first to explain in it thankyou so much
@akshyananda72193 жыл бұрын
Thank you Sir, Working on DS and Algo questions these days, your explanations to problem statements and codes help a lot.
@Pepcoding3 жыл бұрын
Happy to help! If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms ) Keep watching and keep loving Pepcoding😊
@ashishgoswami63034 жыл бұрын
Sir, I've seen Ur video where you asked people to not call you God. But each time a watch a video of yours it's the only thing that crosses my mind this person has godlike teaching skills unparalleled by any other person . This bootcamp will blow up to be India's finest very soon. I'm just happy I got the chance to study from you 😁
@Pepcoding4 жыл бұрын
Wow, thank you
@ExGoogleAmazon Жыл бұрын
JAB KISI BHI VIDEO SE SAMAJH NHI ATA TO MAI IS CHANNELE PE ATA HU , ITNA EASY BATATE HAIN KI
@TabrezAlikhan79602 жыл бұрын
Sir yadi mare aap ka content complete kar liya to kite salary ka package lag satka he sir yah par Coching available nahi ye sir
@rishabhgupta54603 жыл бұрын
what is queen so far why we are passing it in printNQueen method anyone
@AnjaliSingh-uq9fy3 жыл бұрын
superb explanation sir, its really helpful when u dry run the code multiple times, thank you for teaching us
@yogeshedekar60783 жыл бұрын
Sir really really good explanation. I think you should write a book explaining your methods. Your methods are so unique and easy to understand.
@TansiBhandari7 ай бұрын
Sir is there any paid DSA course of yours??
@aashishgoyal14364 жыл бұрын
Thanks a lot for such a valuable content
@Pepcoding4 жыл бұрын
My pleasure
@zeeshanalimannur5704 Жыл бұрын
it was fun understanding this problem
@zeeshanalimannur5704 Жыл бұрын
it was fun understanding this problem
@abhishekkumaryadav19282 жыл бұрын
Amazing... Sir love you❤️❤️
@AbhinavGupta34143 жыл бұрын
Nice one. Have been revising it from 5 years. Don't think I will need to revisit the topic ever after. :)
@Pepcoding3 жыл бұрын
Excellent! Keep learning, Keep growing and keep loving Pepcoding!😊
@freelancedeveloper25913 жыл бұрын
if you can tell the time complexity that will be very much benificial for us
@Pepcoding3 жыл бұрын
Beta, I regret to inform you that, I won't be able to answer/solve the personal doubts of each and every student over here. For clearing your doubts, you can join our community on telegram - t.me/pepcoding.
@freelancedeveloper25913 жыл бұрын
@@Pepcoding i will definitely join it
@_Burhan_Hilal_ECE_ Жыл бұрын
Sir i swear by God i searched for this problem on youtube and watched almost all the videos but could not understand the proper working of this problem/backtracking. U made it so easy that even a layman can understand. Seriously agar yaha sai nhi samjha toh kahi aur sai b nhi samjh pavo gai. I have watched other videos of u and the unique thing i noticed about you is u do the dry run of every problem. Really appreciate ur efforts sir. U made my day sir. 🥺🥺
@info1.0916 ай бұрын
Very nice teaching style great sir
@adityapathak3002 жыл бұрын
Itna detail mai sb cheeze koi nhi samjhata Respect to you Sir!!
@Pepcoding2 жыл бұрын
Hope you love the explanation, for better experience and well organised content visit - nados.io
@TabrezAlikhan79602 жыл бұрын
You DS and java ke King ho sir
@raj_kundalia2 жыл бұрын
Watched on 22 Dec, 2021 - Thanks for the video.
@Pepcoding2 жыл бұрын
Glad you liked it! Keep learning. And for better experience and well organised content visit nados.pepcoding.com
@SCRIPTSAG3 жыл бұрын
Sit time complexity sir eski n*n se bhi jata hogi kya
@Pepcoding3 жыл бұрын
n raise to power n beta
@rithikraj18133 жыл бұрын
Row wala case optimize kr skte h set use krke aur vaise bhi set ki atmost n hi hogi aur syed aur syed iss question ko aur bhi optimize krra jaa skta h kyun ki queen knight ki chaal nii chalti to agr 2 knight attacking position mei h to to vhi queen ka position hoga to dhaai dhaai ki call lgakr bhi syed krra jaa skta h....usme bas yeh check krna pdega ki koi bhi queen ek dusre ki row aur column mei nii honi chahiye....... aacha n queens place krni pdhi h na to yeh nii hoga kahe ki yeh 2 queens ki bhi solutions de dega to agr atmost n queen huaa to yeh solution de skte ho...syed...maybe....
@exposevideo57873 жыл бұрын
Sir 2 ka lea nahi sal ra ha
@mdshaheerrafeeq24383 жыл бұрын
Sir I have seen so many videos but your content is out standing , the way you teach line by line is awesome 😎.
@Pepcoding3 жыл бұрын
I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem. If you like our efforts, we request a review g.page/Pepcoding/review?rc You can subscribe to our channel here kzbin.infoabout?view_as=subscriber
@arihantjain58693 жыл бұрын
Sir jab hamara matrix size 3 ki hogi jab queen (0,0) and (1,2) pe place bhi to ho sakti hai. Please resolve my query.
@harshitgoyal23822 жыл бұрын
zindgi bhr aapka gulam bnne ko tyyar hai sir....
@Pepcoding2 жыл бұрын
Hope you love the video! For better experience and well-arranged content visit- nados.pepcoding.com Don't forget to follow us on Instagram instagram.com/pepcoding/
@HarshKumar-nh6be4 жыл бұрын
Sir fabulous teaching none of teachers was able to explain this problem....mind blowing sir..😎😎😎❤❤❤❤❤❤❤. KEEP IT UP SIR!
@Pepcoding4 жыл бұрын
glad you liked it!! keep watching !!share among you peers
@HarshKumar-nh6be4 жыл бұрын
@@Pepcoding why not? You are my best teacher😊
@sushilvarande62233 жыл бұрын
Finally understand the N-queen problem by watching a video once. Sir, you are great and thank you for your effort and great teaching.
@Pepcoding3 жыл бұрын
Thankyou beta! I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem. If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
@Anand145272 жыл бұрын
Amazing explanation
@ankoor3 жыл бұрын
Python code: class Board(object): def __init__(self, n): self.n = n self.board = [[0 for _ in range(n)] for _ in range(n)] def solve(self, row, result, output): if row == self.n: output.append(result[:]) return for col in range(self.n): if self.isSafeCell(row, col): self.board[row][col] = 1 result.append((row, col)) self.solve(row+1, result, output) result.pop() self.board[row][col] = 0 def nQueens(self): result = [] output = [] self.solve(0, result, output) return output def isSafeCell(self, row, col): # Vertical check for r in range(row-1, -1, -1): if self.board[r][col]: return False # Main diagonal check r = row - 1 c = col - 1 while r >= 0 and c >= 0: if self.board[r][c]: return False r -= 1 c -= 1 # Minor diagonal check r = row - 1 c = col + 1 while r >= 0 and c < self.n: if self.board[r][c]: return False r -= 1 c += 1 return True def display(self): for row in self.board: print(row) b = Board(4) output = b.nQueens() print(output)
@binodkumarsingh17053 жыл бұрын
What to say, Many thanks to Pepcoding you guys make coding simple... 😎
@prachisingh5771 Жыл бұрын
well explained sir
@yuvrajsubh6723 Жыл бұрын
Great explanation. Truly very helpful for me.
@adarshsaraf97022 жыл бұрын
sumeet sir is lord
@ayushjain53604 жыл бұрын
Awesome Explanation, Sir
@Pepcoding4 жыл бұрын
Keep watching
@loserfruit96633 жыл бұрын
Thanku ❤️❤️
@nidhirani85592 жыл бұрын
One of the best explanation Sir... Mja aa gya..
@RitikRaj-ze8xg3 жыл бұрын
Finally, crystal clear explanation, great work sir Ji 🔥🔥🔥🔥
@Pepcoding3 жыл бұрын
Thankyou beta! I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem. If you like our efforts, will you like to review us here - g.page/Pepcoding/review?rc
@utkarshsharma11852 жыл бұрын
Thanks
@AyushKumar-fk5lm2 жыл бұрын
Gazab explanation! Itna achha koi nahi samjha sakta ye sawal!!
@vaibhavpanvalkar30253 жыл бұрын
best backtracking and N queen explanation ever.
@danishrockz13 жыл бұрын
pls try to categorize questions company wise
@FirstLearningthanEarning3 жыл бұрын
for(int i = row, j = col - 1; j >= 0; j--){ if(chess[i][j] == 1){ return false; } } Sir horizontal check laga skte h kya
@_Billa_0073 жыл бұрын
zaroorat hi nahi hai
@0_0-0_0.3 жыл бұрын
Sir which software you use for drawing. It is good for us visualise or draw problem and algorithms before coding Please tell me🙏🏻🙏🏻
@thexhist36093 жыл бұрын
openboard
@ProgrammingWithProject3 жыл бұрын
Sir you are the best teacher in the world 🌍
@sakshiaggarwal61993 жыл бұрын
khud se bhi dry run krke bhot acha samajh aya sir. Thank you so much !!
@mindbodyps2 жыл бұрын
Only one ⭐ in whole youtube
@Pepcoding2 жыл бұрын
Hope you love the explanation, for better experience and precisely organised content sign up on nados.io and start learning.
@devanshpurwar2 жыл бұрын
maaja agya sir
@girikgarg8 Жыл бұрын
Done!
@kasturisanyal66492 жыл бұрын
This was such a great explanation. No doubt you are the best recursion teacher. Thank you so much for this detailed explanation. you made sure that every student understand the logic ! Keep uploading such great videos:)
@Pepcoding2 жыл бұрын
Keep learning and keep motivating. For more such exciting content, don't forget to visit nados.pepcoding.com
@Arun-ue4co4 жыл бұрын
Sir what is the time and space complexity?
@Pepcoding4 жыл бұрын
kaun program kitna time lega, kitni memory khaega. aur input ka size badhega to time aur memory kaise badhega ye analysis karna.
@anjneykumarsingh44614 жыл бұрын
String aur time complexity dal dijiye ye sb bhut hard h
@deepakojha32164 жыл бұрын
@@anjneykumarsingh4461 Bhai space-time complexity pe @pepcoding wale na Dalen to thats best kyunki en topics pe time waste hi hota h ....tum ye sab 1/2 hour me samajh jaoge google KR lo ....but bro salute to @pepcoding for valuable content...
@anjneykumarsingh44614 жыл бұрын
Yes bro i have done it see it's 1month old comment, I use to cry with recursion it's like God gift apoorva di told me about sir
@sakshamsrivastava62803 жыл бұрын
most beautiful video on the this topic
@abhishek59664 жыл бұрын
sir please provide us a video of graph colouring and practice of some questions on it .
@Pepcoding4 жыл бұрын
Yes, this will be covered in level2
@abhishek59664 жыл бұрын
sir i will put all my suggested topics here which i will find hard to understand and which others have also not covered very well ..as it will help us .If you feel my suggestions are good then please also make videos on those topics . currently---FLUERY'S ALGORITHM and other important algos and methods to detect euler circuit
@Pepcoding4 жыл бұрын
@@abhishek5966 beta kra dunga. level2 ke baad level3 mei jo kahoge use treat kar dunga.
@DivyaPrakash-bj6zk2 жыл бұрын
I will definitely crack my dream company and all credit goes to Sumeeet Sir ❤❤❤❤
@Pepcoding2 жыл бұрын
Keep it up. For better experience and well organised content visit - nados.pepcoding.com
@deeksha65143 жыл бұрын
Super awesome explanation! Sir
@anmoldogra51503 жыл бұрын
Sir is question ko seedha krnesolve Kiya toh nhi BNA pr pr thodi Der video Dekh k approach samaz as gyi..sir khud se Kaise bnaye ya time k Saath Saath problem krte aa Jayega ...bdiaya smzaya sir Aapne🔥🔥
@Pepcoding3 жыл бұрын
Thankyou beta! Keep learning and keep loving Pepcoding
@ankushsaini20683 жыл бұрын
👍✌
@sanketsinha98163 жыл бұрын
Sir question ka solution dekhna pr rha ha but ek bar dekhne k bad me clear ho jata .. khud se kaise bnaye sir kya time k sath problem solve krte aa jaega ? Btw Love your teaching Style sir
@Pepcoding3 жыл бұрын
beta ye to time ke sath he hota hai. jab 1000 question solve kar loge to thought process ban chuka hoga
@AshishGusain172 жыл бұрын
thanks for the video
@Pepcoding2 жыл бұрын
Glad to know, that you love the explanation, for better experience and precisely arranged videos. Visit - nados.pepcoding.com and sign up to NADOS. Don't forget to follow us on Instagram instagram.com/pepcoding/
@vihaansingla50884 жыл бұрын
Sir questions kudh nhi bante Solution dekhna padta hai sir please help
@Pepcoding4 жыл бұрын
beta ye normal hai. 1000 questions kar lo. try -> watch -> solve mode mei. uske baad watch ki jarurat nahi pda karegi.
@vihaansingla50884 жыл бұрын
@@Pepcoding thank you sir i like your videos and services
@anjneykumarsingh44614 жыл бұрын
Bhai kisi se nhi hote jee main k question direct thori solve hojate the
@learn_with_yourself3 жыл бұрын
great man!! lot of love to your dedication
@SCRIPTSAG3 жыл бұрын
Sir esme base jo hai wo sirf answer print kerne ke liye lgaya hai uske bad return ker diya hai taki wo jha se aya hai wo next pe check ker sake ki koi aur to nhi hai na
@Pepcoding3 жыл бұрын
ji sahi baat
@pranavvyas72183 жыл бұрын
has anyone tried this question in c++ with the approach that sir has taught ?
@piyushparadkar62902 жыл бұрын
I did Cant understand why solution is coming wrong answer for 4 is same as written but after submiting its showing wrong answer even i cross checked 4 times.
@vidyabhushan76552 жыл бұрын
Amazing explanation!
@ruirui73443 жыл бұрын
thanks, sir for your effort.
@abhishekranjan10943 жыл бұрын
Sir why its not working for output 2 and 3 😊🙌
@utkarshpant52972 жыл бұрын
Because there is no way you can put N queens in every row for 2x2 or 3x3 board