N Queens - Solution | Recursion | Data Structures and Algorithms in JAVA
Vložit
- čas přidán 26. 07. 2020
- Please consume this content on nados.pepcoding.com for a richer experience. It is necessary to solve the questions while watching videos, nados.pepcoding.com enables that.
NADOS also enables doubt support, career opportunities and contests besides free of charge content for learning. In this video, we discuss the solution of the N Queens Problem where we are required to place multiple queens on n*n chessboard (array) such that each queen is safe from the other placed queens. To watch the solution of this problem, click here:
For a better experience and more exercises, VISIT: www.pepcoding.com/resources/o...
#pepcoding #java #programming
Have a look at our result: www.pepcoding.com/placements
Follow us on our FB page: / pepcoding
Follow us on Instagram: / pepcoding
Follow us on LinkedIn: / pepcoding-education
No teacher is present currently who can explain this topic in easy manner amazing job
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
InstaBlaster.
@@Pepcoding Ye baat copy pasted message ke form mein hi kyun likhna.
Kabhi normally bhi bol diya karo
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
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😊
I watched it twice and the more I watch it ,the more I understand about the working of the Euler. Amazing explanation!!
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 )
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 ❤
At 10:00 he's speaking the language of the gods 🥺🥺😍😍 amazing explanation sir
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 !
Still if u didn't get the problem then no one on this planet can teach you better than this ❤️
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
I was stuck in implementation of isSafe method and your tutorial helped me to understand that. Thanks a lot for the clear explanation.
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)
No teacher is as dedicated as him to make us understand the topic please guys subscribe the channel he is great
Thanks buddy!
Always keep supporting and loving like this.
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.
Glad you liked it!
Keep learning.
And for better experience, visit nados.io, where you will get well curated content and career opportunities.
@@Pepcoding sure and thanks again!
Man, the clarity of your explanations is mind boggling.
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
next level teaching,although ive paid for the course(gtbit program) still i watch your videos instead of attending zoom classes.
Beta, class zrur attend kre because standalone videos itni benificial nh hoti, jitna live classes hoti h.
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
Student at someother x academy learning from pepcoding thats how much good he is
Never thought N-Queen would be this easy.. All credits to you..🙏❤️
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 )
Probably the best explanation of N-Queens Ever. #Respect.
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. 🥺🥺
thankyou no one explained recursive tree you are the first to explain in it thankyou so much
khud se bhi dry run krke bhot acha samajh aya sir. Thank you so much !!
Itna detail mai sb cheeze koi nhi samjhata
Respect to you Sir!!
Hope you love the explanation, for better experience and well organised content visit - nados.io
Gazab explanation! Itna achha koi nahi samjha sakta ye sawal!!
Thank you from Bangladesh. Amazing video. I love your explanation and dry run system.
superb explanation sir, its really helpful when u dry run the code multiple times, thank you for teaching us
I watched many videos, but for understanding code this is best.
Sir really really good explanation. I think you should write a book explaining your methods. Your methods are so unique and easy to understand.
Thank you Sir, Working on DS and Algo questions these days, your explanations to problem statements and codes help a lot.
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😊
Finally understand the N-queen problem by watching a video once. Sir, you are great and thank you for your effort and great teaching.
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 )
best backtracking and N queen explanation ever.
What to say, Many thanks to Pepcoding you guys make coding simple... 😎
Lajaawab explanation sir ji.... Excellent job... I am your big fan sir ji....
Sir I have seen so many videos but your content is out standing , the way you teach line by line is awesome 😎.
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
czcams.com/users/Pepcodingabout?view_as=subscriber
Nice one. Have been revising it from 5 years. Don't think I will need to revisit the topic ever after. :)
Excellent! Keep learning, Keep growing and keep loving Pepcoding!😊
great man!! lot of love to your dedication
it was fun understanding this problem
Sir you are the best teacher in the world 🌍
Amazing... Sir love you❤️❤️
Finally, crystal clear explanation, great work sir Ji 🔥🔥🔥🔥
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
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 😁
Wow, thank you
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.
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:)
Keep learning and keep motivating.
For more such exciting content, don't forget to visit nados.pepcoding.com
Watched on 22 Dec, 2021 - Thanks for the video.
Glad you liked it!
Keep learning.
And for better experience and well organised content visit nados.pepcoding.com
Very nice teaching style great sir
most beautiful video on the this topic
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.
One of the best explanation Sir... Mja aa gya..
Sir aapne to speachless kar diya, bhot bhatareen tarike se samjhaya ab to main kisi ko bhi ye solution samjha sakta hu itna achhe se samaj aa gaya.
Thanks a lot, sir. More power to you!!!!!
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.
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 )
@@Pepcoding I would love to contribute and write about precoding and its content. Sir please give me some days to think and then will get back to you with the link of post on quora
Great explanation. Truly very helpful for me.
thanks, sir for your effort.
Amazing Explanation sir !
Thanku ❤️❤️
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
Super awesome explanation! Sir
Amazing explanation
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🔥🔥
Thankyou beta!
Keep learning and keep loving Pepcoding
Amazing explanation!
love pepcoding!
Sir fabulous teaching none of teachers was able to explain this problem....mind blowing sir..😎😎😎❤❤❤❤❤❤❤.
KEEP IT UP SIR!
glad you liked it!! keep watching !!share among you peers
@@Pepcoding why not? You are my best teacher😊
JAB KISI BHI VIDEO SE SAMAJH NHI ATA TO MAI IS CHANNELE PE ATA HU ,
ITNA EASY BATATE HAIN KI
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...
well explained sir
No words to say🥇
thanks sumit sir...you are the best teacher
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 and Keep loving😊
Thanks
Thanks a lot for such a valuable content
My pleasure
Sir keep teaching you are surely going to achieve great heights one day.
Thank you so much for your kind blessings
sir sach mein aap to bhagwaan ho hum jaise baccho k liye !
Glad you liked it!! keep watching and share among your peers
Respect for your efforts ❤️
Thankyou!
It really means a lot😊
No one can teach like you
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
czcams.com/users/Pepcodingabout?view_as=subscriber
Done!
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 ;
}
}
Awesome Explanation, Sir
Keep watching
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
You DS and java ke King ho sir
thanks for the video
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/
god level explanation sir jiiii 😍😍😍 thanku
Thankyou beta!
If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
maaja agya sir
sir bhut hi accha pdate ho ap....
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😊
Great explanation.
Glad you liked it
what is queen so far why we are passing it in printNQueen method anyone
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....
Incredible ❤️
Glad to know that you love our video, for better experience.
Visit - nados.pepcoding.com and sign up to NADOS.
Don't forget to follow us on Instagram instagram.com/pepcoding/
zindgi bhr aapka gulam bnne ko tyyar hai sir....
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/
Thank you sir i like your videos
So nice of you
Sir I'm getting stack overflow error .. please help mee😭
Very good explanation sir
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
for(int i = row, j = col - 1; j >= 0; j--){
if(chess[i][j] == 1){
return false;
}
}
Sir horizontal check laga skte h kya
zaroorat hi nahi hai
BEAUTYYYYYYYYYYYYY!
Sir kya explanation hai!
wow, this cheers me up. I am glad we at pepcoding could be of help to you. Keep learning. Also, recommend us to your juniors and peers, they may also benefit.
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
ji sahi baat
Thankyou sir
Happy to help
Sir which software you use for drawing.
It is good for us visualise or draw problem and algorithms before coding
Please tell me🙏🏻🙏🏻
openboard
Sit time complexity sir eski n*n se bhi jata hogi kya
n raise to power n beta
excellent
Thank you! To watch more content like this please visit nados.pepcoding.com
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????
great!!
sure sir!
Only one ⭐ in whole youtube
Hope you love the explanation, for better experience and precisely organised content sign up on nados.io and start learning.
lelo sir anumati, aap h rkhiye unko. aaajse Anumati aapki
G.O.A.T
Best ❤️
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
czcams.com/users/Pepcodingabout?view_as=subscriber
Thanks a lot sir for such a great explanation, I performed a dry run in this question for 3 times. This is question has been another of my nightmares for past years and thank you for clarifying it so well.
You are most welcome
Best sir,
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
czcams.com/users/Pepcodingabout?view_as=subscriber