279. Perfect Squares | 5 Ways | DP | Math | BFS | Lagrange & Legendre Theorem | Top-Down | Bottom Up

Поділитися
Вставка
  • Опубліковано 16 гру 2024

КОМЕНТАРІ • 27

  • @thefinestmeme3317
    @thefinestmeme3317 5 місяців тому +1

    oh my god you are absolutely amazing

  • @RishiRajMusa
    @RishiRajMusa 4 місяці тому +1

    I remembered my 12th math class, you are amazing.

  • @nooob_coder
    @nooob_coder 10 місяців тому +3

    most complete channel...come up with dsa series

  • @hajikhalil4268
    @hajikhalil4268 2 місяці тому

    I'm impressed with the way you explain the problem :)

  • @cybermonkey2807
    @cybermonkey2807 10 місяців тому +9

    I have a feeling...you are gonna blow up on youtube very soon god bless.

    • @gamenotover1600
      @gamenotover1600 10 місяців тому

      yo ,your pfp is same as my phone's wallpaper...Big fan of cowboy bebop

  • @pratik5756
    @pratik5756 10 місяців тому +1

    one of the most underrated DSA channel.
    keep up the good work bro!!!!

  • @pawanmalik2998
    @pawanmalik2998 10 місяців тому +3

    we can also solve this problem using coin change approch ....
    just find max possible number which square is less or equal to n
    then use coins i as (i*i) range from 1 to max possible number which square is less or equal to n

    • @rajrajesh1669
      @rajrajesh1669 10 місяців тому +2

      Yes but that will not be the most efficient approach though,
      If we're on the same page, It will be a 2-d Dp solution right?
      But it will not throw TLE either...

  • @arastusharma439
    @arastusharma439 10 місяців тому +1

    Awesome Explanation bro !! The math behind the theorem you explained it very well !! 👋👌✌

  • @debabratagon7289
    @debabratagon7289 10 місяців тому

    Nice explanation bro

  • @bharatmehta30
    @bharatmehta30 10 місяців тому

    Great explaination bhai. Thank you for doing beautiful work.

  • @satwiktatikonda764
    @satwiktatikonda764 10 місяців тому

    the only one channel wch discuss abt all the approaches

  • @ritikrajprasad2407
    @ritikrajprasad2407 10 місяців тому +1

    Just some doubt, if we are continuously dividing n by 4 and then the resultant is getting stored in n then the for loop is being run through that "modified" value of n, which would have a different square-root value than the actual n, then why even after this modification, we are getting the correct answer!!

  • @me-16ayushverma40
    @me-16ayushverma40 10 місяців тому

    these two theorem are life saver😅

  • @gyaniyoda4608
    @gyaniyoda4608 10 місяців тому

    wow

  • @kannank4269
    @kannank4269 10 місяців тому

    for checking whether it is i^2 + j^2 + k^ 2 = N, we can i and j uptill cube root of N, we can find k using i, j, N. this also works right?

  • @abhinay.k
    @abhinay.k 10 місяців тому

    thanks

  • @debabratagon7289
    @debabratagon7289 10 місяців тому

    In the Math technique While explaining the theory you used the condition of 2 first hence it was justified to use the condition 4 next (as it is the only option left) but in the code you wrote the condition of 4 first then 2 . how is it justified?

  • @harshal8781
    @harshal8781 10 місяців тому

    aryan bhai i 1st wrote top-down approach it gave TLE and when I converted it to bottom up it passed all the TC and got accepted too. But as you mentioned both have the same TC and SC so how its possible?

  • @meetpalsingh2933
    @meetpalsingh2933 10 місяців тому

    Was fast-paced, but nice explanation. Confused the hell out of me when you highlighted the node of 3rd depth instead of 4th.

  • @me-16ayushverma40
    @me-16ayushverma40 10 місяців тому

    bhaiya from where u know abt this theorem....

  • @joydeeprony89
    @joydeeprony89 10 місяців тому +7

    bro one suggestion go little slow

  • @samagraagrawal5333
    @samagraagrawal5333 10 місяців тому +1

    Does the interviewer expects us to know these theorems?

    • @rajrajesh1669
      @rajrajesh1669 10 місяців тому +1

      I think no...
      Not every problem can be solved using theorems,
      But when we have a choices based problem and if we can break a bigger problem into sub problems then DP works for everything.
      I think, for this problem, 1D dp solution is more than enough.....

    • @harshal8781
      @harshal8781 10 місяців тому

      @@rajrajesh1669 agreed :)