Uncrossed Lines | Dynamic programming | Leetcode

Поделиться
HTML-код
  • Опубликовано: 19 окт 2024

Комментарии • 161

  • @mrinalraj7166
    @mrinalraj7166 4 года назад +33

    The concept explained here cannot be found anywhere on the RUclips. It's just priceless.

  • @ashutoshaswal
    @ashutoshaswal 4 года назад +27

    The problem is same as Longest Common Subsequence.
    And great explanation Sir!

  • @ayushgarg5929
    @ayushgarg5929 4 года назад +7

    Sir , the chronology of your teachings style is just awesome

  • @shresthmishra9329
    @shresthmishra9329 4 года назад +4

    I've grown to be a fan of your vedio.They're my first stop for any question or concept I need to clarify on programming!

  • @ajithpalani5139
    @ajithpalani5139 4 года назад +3

    Great teachers are in youtube,useless teachers are in my university.thank you tech dose for this wonderful video🔥.God bless you⚡⚡⚡

  • @weixia
    @weixia 4 года назад +14

    well explained, thanks Tech Dose.

  • @AmanKumar-ht8xi
    @AmanKumar-ht8xi 4 года назад +10

    Very well explained .. There will be a day when your channel will have almost all the important questions asked in interview.. and a large number of follower ..Keep working bro.. God bless..😃

  • @starc701
    @starc701 4 года назад +1

    after some time this channel will be the gold for people.. Thanku very much bro ...explained very fluently.

  • @setYourHandleHttp404
    @setYourHandleHttp404 4 года назад +2

    I watched almost all of your videos. Nice explanations! Thanks!!

  • @MrAditya2rock
    @MrAditya2rock 4 года назад +3

    Thank you so much for the video. It might take one some practice to intuitionalize but the concept is well explained.

  • @yitingg7942
    @yitingg7942 3 года назад +1

    Yeah!!! I solved this one bug free without watching this video. 😎 Now I am going to relax and watch this video lol.

  • @AmanKumar-ht8xi
    @AmanKumar-ht8xi 4 года назад +3

    If you ever get time please come live bro.. we love to watch you and your awesome suggestions..

    • @techdose4u
      @techdose4u  4 года назад +2

      It's difficult since I am making videos everyday 😅 I will come live later when I get time.

  • @ShubhamMahawar_Dancer_Actor
    @ShubhamMahawar_Dancer_Actor 4 года назад +6

    Question formatted so differently ,it simply asking fin dthe length of maximum subsequence of 2 list.BTW WELL EXPLAINED.

    • @techdose4u
      @techdose4u  4 года назад

      Yes true :)

    • @spetsnaz_2
      @spetsnaz_2 4 года назад +1

      took me 3hrs to finally get to the solution

  • @mrinalraj7166
    @mrinalraj7166 4 года назад +2

    You are amazing!!!! Thanks for making these videos.

  • @100bands
    @100bands 4 года назад +1

    Your explanation makes so much sense. Thank you

  • @satyajitdas2780
    @satyajitdas2780 4 года назад +1

    Thanks. Bro. Excellent explanation. Along with code.

  • @prabhujoseph4121
    @prabhujoseph4121 2 года назад +1

    Great Video. This looks same as Longest Common Subsequence.

  • @vikrantrajan8707
    @vikrantrajan8707 2 года назад

    Thank you for making this video. This is gold!

  • @sunnysam69
    @sunnysam69 4 года назад

    Very well explained! Find it very tough to crack DP problem s

  • @JP-uv2nh
    @JP-uv2nh 4 года назад +1

    Clearly explained. Good job.
    I think default values in a vector is '0'. So, I guess we can directly start from '1' in both loop variables.

    • @techdose4u
      @techdose4u  4 года назад +1

      Nice suggestion. I never checked for default value. If it is true then it will make things easier.

  • @amishbhat3560
    @amishbhat3560 4 года назад +1

    Thank You So much.Very well explained.

  • @dovyraj1272
    @dovyraj1272 4 года назад +1

    sir, is this equal to the max sub sequence problem ??

  • @hemanthn436
    @hemanthn436 4 года назад +1

    Superb explaination sir
    We expect more content from you

  • @kushgupta1187
    @kushgupta1187 4 года назад +4

    Well explained and covered everything. I need your help... Could you please help me from where I can learn dp.. I am lacking in it and usually i am not able to develop recursive equation to solve dp problem.
    Thanks in advance 😊

    • @techdose4u
      @techdose4u  4 года назад +2

      You can only do it with practice. Keep finding reasons for each steps followed in dp and keep practicing. It will be easier as time goes by.

  • @NikhilKumar-oy7mx
    @NikhilKumar-oy7mx 4 года назад +2

    I am really bad at dp. but you explain it really nice.
    BTW your channel has grown a lot, congratulations.
    The channel was quite new when i joined.
    Great job.

    • @techdose4u
      @techdose4u  4 года назад +2

      Practice will improve you in everything (including dp). I hope we keep growing our community :)

  • @dipanjanjayswal507
    @dipanjanjayswal507 4 года назад

    please make a clear video on *Generate all the binary strings of N bits* and how the code is working. Please 🙏

  • @pradeepkumar-xt5fl
    @pradeepkumar-xt5fl 4 года назад +1

    One problem with your playlist is it show several video of same topic or u have uploaded same video many time or it just bug?

  • @ESudarshan
    @ESudarshan 4 года назад +1

    thank you!
    It would be of great help if you could share the recursive solution as well.

    • @techdose4u
      @techdose4u  4 года назад +1

      I deleted it 😅 The recursion solution is same as Longest Common Subsequence. Please follow that.

  • @rohithkumartangudu4664
    @rohithkumartangudu4664 4 года назад +1

    How did u got which data structure should be used for this problem?? I tried using strings but it failed for so many testcases.

    • @techdose4u
      @techdose4u  4 года назад

      You could have used recursion or memoization or DP. But what technique did you use?

    • @rohithkumartangudu4664
      @rohithkumartangudu4664 4 года назад

      @@techdose4u I didn't got the idea to use recursion or DP. Firstly convert the two arrays into strings and after that take take one by one from first string and finding the index of that character In the second string. And then I used some conditions which are failing for some testcases. So I thought I did wrong in my approach.

  • @ArifulIslam-im7wr
    @ArifulIslam-im7wr 3 года назад +1

    Thank you so much...sir

  • @amarnaath5673
    @amarnaath5673 4 года назад +3

    Please post a video Interview prep video GeeksforGeeks Vs Leetcode for preparation

    • @techdose4u
      @techdose4u  4 года назад

      Nice idea. I will do it :)

  • @rajathnayak5624
    @rajathnayak5624 4 года назад +1

    similar to longest subsequence in 2 strings
    nice explanation thank you sir

    • @techdose4u
      @techdose4u  4 года назад +1

      Yes....welcome :)

    • @Cube2deth
      @Cube2deth 4 года назад +1

      @@techdose4u How is it different from LCS? it looks exactly the same

    • @techdose4u
      @techdose4u  4 года назад +1

      Both are same.

  • @vaibhavpareek5571
    @vaibhavpareek5571 4 года назад +1

    Very well explained....

  • @ujjwalmaheshwari2327
    @ujjwalmaheshwari2327 Год назад +1

    awesome explaination

  • @ayushisharma1381
    @ayushisharma1381 4 года назад +1

    Thanks sir... For making these videos.. Helps a lot :)

  • @harshpatel1385
    @harshpatel1385 4 года назад +1

    Great explanation. Keep uploading video

  • @teddylun
    @teddylun 4 года назад +1

    Very clear explanation :)

  • @Aree.TiwariJii
    @Aree.TiwariJii 3 года назад

    Much better than apna college.

  • @mukulpanchakarla8944
    @mukulpanchakarla8944 4 года назад +1

    Subscribed!!!!!

  • @yashpreetbathla4653
    @yashpreetbathla4653 4 года назад +1

    Wow man such an amazing video WOW

  • @pabitrakb5291
    @pabitrakb5291 Год назад

    Wow explanation

  • @bhuwansingh2534
    @bhuwansingh2534 3 года назад +1

    what's the point of configuring the std i/o streams if we're not doing any input or output operations?

    • @techdose4u
      @techdose4u  3 года назад +1

      Just a template repetition maybe

  • @amirjutt0
    @amirjutt0 Год назад

    sir , I think there is a mistake in this question . The answer for 2 3 2 and 2 in the cell [3][1] should be 2 but it is one. In my opinion , the correct formula for case where character matches is max(left cell , upper cell) + 1.

  • @hemanthn436
    @hemanthn436 4 года назад +1

    Explain backtracking problems also sir

  • @vishnuvardhan-md1ux
    @vishnuvardhan-md1ux 4 года назад +1

    I applied longest increasing subsequence technique dp[i] = max(dp[i],dp[j]+1) for all j < i and (j & i) are non intersecting.
    bool isnotIntersecting(pair& curr_pair,pair& prev_pair)
    {

    if((curr_pair.first>prev_pair.first) && (curr_pair.second>prev_pair.second))
    {
    return true;
    }

    return false;
    }



    int maxUncrossedLines(vector& A, vector& B) {

    vector pairs;
    unordered_map um;

    for(int i=0;i

    • @vishnuvardhan-md1ux
      @vishnuvardhan-md1ux 4 года назад

      Can you add a video of the dice roll simulation problem in leetcode?

  • @Shashank0002
    @Shashank0002 3 года назад

    Wow, I just realised that this question is another version of finding LCS.

  • @kunalkheeva
    @kunalkheeva Год назад +1

    Thank you!

  • @animatedzombie64
    @animatedzombie64 3 года назад

    getting this intuition is tough, how do you get it. just blown up my brain

  • @shobhitkumar6820
    @shobhitkumar6820 4 года назад +1

    very well explained sir

  • @snehal462
    @snehal462 4 года назад

    Great explanation!

  • @amangupta9776
    @amangupta9776 4 года назад +1

    Always be great approach

  • @dhanashreegodase4445
    @dhanashreegodase4445 2 года назад

    Thank you so much

  • @m00oon
    @m00oon 4 года назад +1

    sir basically we have to find longest common subsequence

  • @anmolwadali9227
    @anmolwadali9227 4 года назад +1

    AWESOME explanation SIR

  • @akshbansal7715
    @akshbansal7715 4 года назад +3

    Which college are you from?

  • @avgerageCSStudent
    @avgerageCSStudent 4 года назад +4

    I think this problem is very similar to 1143. Longest Common Subsequence : leetcode.com/problems/longest-common-subsequence/

  • @franksheng4173
    @franksheng4173 4 года назад +1

    great explanation.

  • @buckbd187
    @buckbd187 4 года назад

    how not crossing line property is being maintained in dp solution.
    we did not did any think to keep the not crossing property or did we
    do something?
    would u plz make me understand how not crossing property is maintained ?

  • @ravilamkoti5081
    @ravilamkoti5081 4 года назад +1

    Is it similar to LCS ?

  • @topgeargaming8679
    @topgeargaming8679 4 года назад

    Which mic do u use bro ?

  • @shaziasamreen8584
    @shaziasamreen8584 4 года назад +1

    How do we get method of using dp?

    • @techdose4u
      @techdose4u  4 года назад

      Ummm....if you think about an easy approach then you will solve it using recursion. If you have solved enough DP problems then you must have come across LCS or similar problems. This one is very similar as well. You need practice to be able to solve DP. Don't worry. Keep practicing.

  • @aviraltiwari9963
    @aviraltiwari9963 4 года назад +2

    Sir what if ex is
    2 4 4
    1 3 4
    It should give 2 but i did dry run and got 1 .
    Pls crrct me.

    • @techdose4u
      @techdose4u  4 года назад +1

      It will be one because only 1 element in list 2 and 1 are common. Watch the video carefully. I have explained the cases for intersection. You must be matching 2 4s of list 1 with one 4 of list 2. This is wrong.

    • @aviraltiwari9963
      @aviraltiwari9963 4 года назад +1

      @@techdose4u okk sir.. Thank u very much!!

    • @techdose4u
      @techdose4u  4 года назад

      Welcome :)

  • @prernachauhan6262
    @prernachauhan6262 3 года назад +2

    This is basically longest common subsequence!

  • @AYUSHISHARMABIT
    @AYUSHISHARMABIT 4 года назад +1

    Heavy video ;)

  • @mohitshoww
    @mohitshoww 4 года назад +6

    Same as Lcs

  • @marvel438
    @marvel438 3 года назад +1

    Wow

  • @garumugam4480
    @garumugam4480 4 года назад +3

    Not sure i got it or not as i find DP as one of toughest areas..😭

    • @techdose4u
      @techdose4u  4 года назад +1

      Needs practice man. You can do it.

  • @shivasaini4097
    @shivasaini4097 3 года назад +1

  • @nikhilkumar-ot9rn
    @nikhilkumar-ot9rn 4 года назад +1

    this is exactly LCS could have directly told that

    • @techdose4u
      @techdose4u  4 года назад +1

      It wouldn't have mattered. People who don't actually fully understand concept of LCS could not have solved it. So, telling them it is LCS will never clear the concept. You knew because you understood LCS preety well I suppose.

    • @nikhilkumar-ot9rn
      @nikhilkumar-ot9rn 4 года назад

      @@techdose4u ok... btw very nice explanation

  • @manthankhorwal1477
    @manthankhorwal1477 4 года назад +1

    Is today's video is late or you have already done it ?

    • @techdose4u
      @techdose4u  4 года назад

      It's late because video was based on graph algorithm and it takes long time to think, explain and edit. Now it's done :) Videos might get late occasionally. Up untill now, questions were easy.

    • @manthankhorwal1477
      @manthankhorwal1477 4 года назад +1

      @@techdose4u great video .. thankyou

    • @techdose4u
      @techdose4u  4 года назад

      Welcome :)

  • @gauravkhurana420
    @gauravkhurana420 4 года назад +1

    Bhaiya count inversions kra do...
    BIT se

    • @techdose4u
      @techdose4u  4 года назад

      Let me first make BIT then I will do it's questions as well.

  • @harshdevrandhawa8355
    @harshdevrandhawa8355 4 года назад +1

    Longest common subsequence problem also has the same solution

    • @techdose4u
      @techdose4u  4 года назад

      This is a different way of putting the same question :)

  • @wewe-fx6un
    @wewe-fx6un 4 года назад +1

    It's LCS.

  • @dayanandraut5660
    @dayanandraut5660 3 года назад

    this is a variation/application of LCS problem

  • @jaydeepmahajan6598
    @jaydeepmahajan6598 4 года назад +1

    After few days tech dose will give resignation letter to his employer because his youtube channel going to lots of subscribers and viewership 😂😂,paisa , paisa 😅

    • @techdose4u
      @techdose4u  4 года назад

      With support of our community, it might come true :)

  • @adarshawasthi5449
    @adarshawasthi5449 4 года назад +1

    LCS problem languaged changed

  • @amanrai9880
    @amanrai9880 4 года назад +1

    This is absolutely similar to common substring

    • @techdose4u
      @techdose4u  4 года назад

      Yea....the famous LCS problem.