N Queens Problem using Backtracking | Branch and Bound Algorithm Explained

แชร์
ฝัง
  • เผยแพร่เมื่อ 31 ม.ค. 2025

ความคิดเห็น • 112

  • @abhinavagrawal6148
    @abhinavagrawal6148 3 ปีที่แล้ว +36

    If explaining code/intution/approach is an art, then sumeet sir is among top artist. ♥️♥️

  • @sudhanshusharma9123
    @sudhanshusharma9123 3 ปีที่แล้ว +15

    Although I had faith but my mind was not ready for such an easy explanation for yet a very difficult topic (Branch and Bound) and a hard question, understood completely in one go. Thanks a lot Sir ❤

  • @shubhishukla9972
    @shubhishukla9972 3 ปีที่แล้ว +4

    You make every topic so simple to understand. Most importantly you enable the students to think in a particular direction and solve problems on their own. Thank you for all this amazing content and the efforts you put in to teach so phenomenally. Huge respect!!!!

  • @09avishkargaikwad71
    @09avishkargaikwad71 ปีที่แล้ว +1

    The way u explaining this hard algorithm is fantastic,, Literally for these 30 min I was completely focused on this video Lecture. Thank You sir...

  • @anssha2643
    @anssha2643 4 ปีที่แล้ว +7

    Your vidoes are always so good, time just flies. I don't find it hard to stay focused. Thanks for all your hard work.

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว

      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

    • @anssha2643
      @anssha2643 4 ปีที่แล้ว

      @@Pepcoding Sir , I submitted my review last week :)

  • @tanjilhossain5595
    @tanjilhossain5595 2 ปีที่แล้ว +5

    Sir, after describing the problem with the solution method and code if you also describe the time complexity along with the method and in the code section it will helpful for me or us. Thanks, sir for your effort, your teaching technique is very much clear and enjoyable.

  • @akatsuki1363
    @akatsuki1363 4 ปีที่แล้ว +4

    Sir your channel will become best yt channel for coding....content is extremely good thanks for sharing best knowledge lots of love❤️

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว

      Thankyou buddy!
      I am glad. 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.
      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 )

    • @akatsuki1363
      @akatsuki1363 4 ปีที่แล้ว

      Sure sir

  • @ankurkumarraj
    @ankurkumarraj 4 ปีที่แล้ว +5

    This is the simplest solution of NQueen problem I could ever get, you made it too easy, Thanks Sirji.

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว

      I am glad you liked it

  • @rajeev2127
    @rajeev2127 4 ปีที่แล้ว +1

    Sir, in this question we don't even need 2d array, we just need the size of it, which is n. There's no use of 2d array, we just need column[ ], leftDiagonal[ ] and rightDiagonal[ ]. BTW great explaination sir maza aagya.

  • @manvityagi6529
    @manvityagi6529 4 ปีที่แล้ว +18

    I wish I could like it multiple times, Thank you so much Sumeet sir and the team of @pepcoding

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว +4

      beta, linkedin pe ek post likh do. Ya google pe review dedo. Help will be much appreciated.
      Thanks,
      Sumeet Malik

    • @manvityagi6529
      @manvityagi6529 4 ปีที่แล้ว +2

      @@Pepcoding Sure Sir, I will definitely do.

    • @vishalkushwaha5373
      @vishalkushwaha5373 3 ปีที่แล้ว

      @Delphine Furnia shut up no one cares

  • @generalalpha9532
    @generalalpha9532 3 ปีที่แล้ว

    we are happy, because we have a teacher like you.

  • @SurajSingh-tz1wr
    @SurajSingh-tz1wr 2 ปีที่แล้ว +1

    Explanation was so simple! Thank you so much!

    • @Pepcoding
      @Pepcoding  2 ปีที่แล้ว

      Glad it helped! For better experience and well organised content sign up on nados.io and keep learning.

  • @AbhishekKumar-yv6ih
    @AbhishekKumar-yv6ih 4 ปีที่แล้ว +2

    Waah sir ji. Level up start krne k liye dhanyawad. Ab na mja aayega bhiru..

    • @NK6722-nk
      @NK6722-nk 4 ปีที่แล้ว +1

      Ab dusre channel pe jaakar bilkul riks ni lene ka re baba 😁😁

    • @AbhishekKumar-yv6ih
      @AbhishekKumar-yv6ih 4 ปีที่แล้ว

      @@NK6722-nk ha ha

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว

      thank you

  • @piyushraj8701
    @piyushraj8701 2 ปีที่แล้ว

    When god comes himself to teach us. God level teaching sir🔥🔥🔥

  • @Master-sy8si
    @Master-sy8si 2 ปีที่แล้ว +1

    Great video! Thanks for this lucid explanation

  • @aryangrover7216
    @aryangrover7216 4 ปีที่แล้ว +2

    Explained in a very Amazing Way. Thanks a lot Sir

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว

      You are most welcome. Thanks for the kind words

  • @kunalnayak7325
    @kunalnayak7325 2 ปีที่แล้ว

    Sir you are at the upper bound of best teaching!!! And sir what will be the time complexity of the solution and how?

  • @FinanceMode14
    @FinanceMode14 2 ปีที่แล้ว +1

    clearly understand the meaning of branch and bound

  • @jatinkumar4410
    @jatinkumar4410 4 ปีที่แล้ว +2

    Your explanations are just amazing...

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว

      Thank you so much beta

  • @tysonslace5385
    @tysonslace5385 4 ปีที่แล้ว +2

    Guru ji bhot bhot dhanyavaad videos ke lie.

  • @aakashakku5
    @aakashakku5 4 ปีที่แล้ว

    Thank you SIR .. I was trying to understand it from many days .. aaj samgh aaya ... thank you

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว +1

      Thankyou beta, for such kind words.
      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/How-do-I-start-learning-or-strengthen-my-knowledge-of-data-structures-and-algorithms )

    • @aakashakku5
      @aakashakku5 4 ปีที่แล้ว

      @@Pepcoding sure Sir

  • @usavlogs9096
    @usavlogs9096 2 ปีที่แล้ว

    Best teacher❤

  • @paragroy5359
    @paragroy5359 3 ปีที่แล้ว +2

    Thanks a lot sir...for the entire playlist..

    • @Pepcoding
      @Pepcoding  3 ปีที่แล้ว +1

      Most welcome and If you like the content could you post something on LinkedIn about us? This will help us in reaching out to more people and help a lot of other students as well
      Something like this
      Sumeet Malik from Pepcoding is making all his content freely available to the community
      You can check it out here - www.pepcoding.com/resources
      /
      Also, this is the youtube channel - th-cam.com/users/Pepcodingplaylists?view_as=subscriber

  • @ssr5052
    @ssr5052 4 ปีที่แล้ว

    u r the best person yaar .. I am able to understand this question after a very long time .. wish u the best of luck .. u r really doing a great job. :)

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว

      Thank you so much

  • @sarthakagrawal8946
    @sarthakagrawal8946 4 ปีที่แล้ว

    Nice way of approaching the solution !!

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว

      Glad you liked it.Keep watching

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว

      Glad you liked it!!

    • @sarthakagrawal8946
      @sarthakagrawal8946 4 ปีที่แล้ว

      @@Pepcoding Definitely your channel will soon hit million! Keep it up!

  • @sarcaastech
    @sarcaastech 2 ปีที่แล้ว

    I don't have words to thank you sir 😊

  • @pratyush__agarwal
    @pratyush__agarwal 4 ปีที่แล้ว +1

    Your explanation are always cool ❤️

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว +1

      Keep watching and keep loving Pepcoding😊

  • @PRATHMESHDATE
    @PRATHMESHDATE ปีที่แล้ว

    Thank you so much sir 🙏

  • @indranilchakraborty5949
    @indranilchakraborty5949 3 ปีที่แล้ว +1

    sir plz discuss few time about time complexity at the end in upcoming vedios

  • @decostarkumar2562
    @decostarkumar2562 3 ปีที่แล้ว +2

    I think there is no requirement for Boolean board of n×n dimension. 🙄🤔

  • @laveshgarg2189
    @laveshgarg2189 4 ปีที่แล้ว

    Sir you are a god for me.. thanku very much i subscribed your channel through two email id to keep you motivated and also shared this vedio

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว

      Thank you! Keep watching...more interesting problems to come.

  • @swastikmishra739
    @swastikmishra739 3 ปีที่แล้ว

    Really good explanation sir

    • @Pepcoding
      @Pepcoding  3 ปีที่แล้ว

      Keep watching.
      And for better experience, visit nados.io, where you will get well curated content and career opportunities.

  • @anmolgirdhar4473
    @anmolgirdhar4473 4 ปีที่แล้ว

    shower of love to you and your hardwork

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว

      Thank you so much

  • @_hulk748
    @_hulk748 2 ปีที่แล้ว

    thankyou sir🙏🙏❤❤

  • @kirtigera2225
    @kirtigera2225 4 ปีที่แล้ว +1

    thankew so much sir....sir what is the time complexity of this solution?

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว

      beta n ki power n.

  • @harshyallewar5876
    @harshyallewar5876 2 ปีที่แล้ว +1

    Nice sir

    • @Pepcoding
      @Pepcoding  2 ปีที่แล้ว

      Glad you liked it!
      Keep learning.
      And for better experience, visit nados.io, where you will get well curated content and career opportunities.

  • @harshitnema4197
    @harshitnema4197 3 ปีที่แล้ว

    You are too good man!🔥

    • @Pepcoding
      @Pepcoding  3 ปีที่แล้ว +1

      Thankyou beta!
      I am glad you liked it. I also hope that you are watching till the end and trying to understand the 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

  • @094_ramankumar9
    @094_ramankumar9 3 ปีที่แล้ว

    amazing explanation sir

    • @Pepcoding
      @Pepcoding  3 ปีที่แล้ว +1

      you can find more of our content on nados.pepcoding.com

    • @094_ramankumar9
      @094_ramankumar9 3 ปีที่แล้ว +1

      @@Pepcoding sure sir

  • @keshavsharma161
    @keshavsharma161 3 ปีที่แล้ว +1

    someone please help.. after function calling why we false all the parts that we mark true??

    • @kashba
      @kashba 2 ปีที่แล้ว

      backtracking hai

  • @DilshadAhmad-ut4yd
    @DilshadAhmad-ut4yd 2 หลายเดือนก่อน

    Sir how can i connect to purchase your course?

  • @piyushsarraf9994
    @piyushsarraf9994 3 ปีที่แล้ว +1

    Sir can u just calculate the time complexity of code

  • @krishnarajyadav3953
    @krishnarajyadav3953 3 ปีที่แล้ว

    Are you first placing Queen in all the rows of column 1 , then rows of column 2 , the rows of column 3 etc ?
    Or in all the columns in row 1 , then columns in row 2 etc ?
    Pls tell i have little confusion here.

    • @mickyman753
      @mickyman753 3 ปีที่แล้ว

      he is placing rows in col 1 ,then in rows of col 2 and so on... ,i will suggest you to watch n queens video of level 1 backtracking

    • @krishnarajyadav3953
      @krishnarajyadav3953 3 ปีที่แล้ว +1

      @@mickyman753 I also think the same . I will watch the video. Thanks

  • @vivekkejriwal3321
    @vivekkejriwal3321 4 ปีที่แล้ว

    If there is no return statement except in row== board.length, what does the function return when it doesn't find the solution on that particular row. Should we add a return statement or it is handled by the compiler itself??

    • @LegitGamer2345
      @LegitGamer2345 4 ปีที่แล้ว +1

      no need to return anything in that case because in that case u have not placed all the queens in such a way that no queen kills another

    • @vishalkushwaha5373
      @vishalkushwaha5373 3 ปีที่แล้ว

      then it simply returns to the main function without printing anything . try for 3 .

  • @danishrockz1
    @danishrockz1 3 ปีที่แล้ว

    pls explain time & space complexity also

  • @kuldeepnarayanminj
    @kuldeepnarayanminj 4 ปีที่แล้ว +8

    prabhu , charan sparsh

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว +2

      arey, mitra. dil se dil mila hai.

  • @GopalKumar-py2cf
    @GopalKumar-py2cf ปีที่แล้ว

    pepcoding ke websites pe server problem hai please check kro question submit nahi kr pa rahe hai

    • @Pepcoding
      @Pepcoding  ปีที่แล้ว

      pepcoding is closed

  • @loserfruit9663
    @loserfruit9663 3 ปีที่แล้ว +1

    Beautiful

  • @shubhnaam12
    @shubhnaam12 3 ปีที่แล้ว +1

    Mazaa aa gaya

    • @Pepcoding
      @Pepcoding  3 ปีที่แล้ว

      For better experience, visit nados.io, where you will get well curated content and career opportunities.

  • @AnkitSharma-wj2tb
    @AnkitSharma-wj2tb 4 ปีที่แล้ว

    thank you sir for explanation

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว

      Ji padhte rahie

  • @lakshmishree1281
    @lakshmishree1281 3 ปีที่แล้ว

    thank you sir

  • @gauravgupta9477
    @gauravgupta9477 4 ปีที่แล้ว

    Just out of curiosity....Every recursive algorithm can be converted in iterative one but I've never seen any backtracking algorithm done in iterative way. Can't we do this way??

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว +1

      Kar sakte hain bilkul

  • @rishavkavlog
    @rishavkavlog 3 ปีที่แล้ว

    hum board[row][col] ko true/false nhi bhi karenge to bhi answer shi aayega

  • @bradbale1510
    @bradbale1510 4 ปีที่แล้ว

    Sir doubt- board[row][col] pe true/false mark karke kya benefit h?

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว

      True wale cellski help se baad mei O(1) mei check ho jata hai ki kahan nahi jana.

    • @aman6561
      @aman6561 4 ปีที่แล้ว

      @@Pepcoding sr yehi kam O(1) me krne ke liye hi to 3 array bnai hai column ki diagonals ki fr board ki zrurt hi kyu hai ?

    • @priyanshu.tiwari
      @priyanshu.tiwari 4 ปีที่แล้ว +2

      @@aman6561 Yes, we don't need board in this case. You are right.

  • @somyasinghal9809
    @somyasinghal9809 4 ปีที่แล้ว

    sir, isme agar hum board[row][col] ko true mark na kre, tab bhi sahi hai na?

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว +1

      agr true mark nhii krogge to pta kasse chllega ki appne us particular queen ko box maii place krvaya ya nhi

    • @somyasinghal9809
      @somyasinghal9809 4 ปีที่แล้ว +1

      @Pepcoding sir hum baaki cols and diagonal array m to true krre h
      And board m true krke use aage kahi use Ni Kiya
      Bas backtrack ke time false kiya h
      Isliye agar na likhe to?

    • @aman6561
      @aman6561 4 ปีที่แล้ว

      @@somyasinghal9809 haa bro code to submit hora hai
      import java.io.*;
      import java.util.*;
      public class Main {
      public static void main(String[] args) throws Exception {
      Scanner scn = new Scanner(System.in);
      int n = scn.nextInt();
      int[] c = new int[n];
      int[] d1 = new int[2*n-1];
      int[] d2 = new int[2*n-1];
      printNqueens("",0,c,d1,d2);
      }
      public static void printNqueens(String qsf,int r,int[] c,int[] d1,int[] d2){
      if(r == c.length){
      System.out.println(qsf + ".");
      return;
      }
      for(int i = 0; i

  • @GopalKumar-py2cf
    @GopalKumar-py2cf ปีที่แล้ว

    may be koi technical issue hai

  • @neb143
    @neb143 4 ปีที่แล้ว +1

    cleaaaaan code

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว

      Thankyou beta!
      Keep watching and keep learning😊

  • @goodpeople7615
    @goodpeople7615 4 ปีที่แล้ว +4

    Boht hard maze aa rahe hai. (^∇^)ノ♪

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว +1

      Keep watching bro.

  • @rhythmjayee9707
    @rhythmjayee9707 4 ปีที่แล้ว

    ✨✨✨✨✨✨👌

  • @rakshitdevra7060
    @rakshitdevra7060 2 ปีที่แล้ว

    Wonderful explanation sir