Perfect Squares ⭕️ Dynamic Programming Leetcode Problems solutions Hello World by prince

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

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

  • @santoshkumarpasi5729
    @santoshkumarpasi5729 Год назад +2

    Best vid on RUclips

  • @TheKu25
    @TheKu25 Год назад +2

    Great Explaination, Thanks alot🙂

  • @adityagoyal9556
    @adityagoyal9556 4 месяца назад

    def numSquares(self, n):
    return self.num(n,{})
    def num(self, n,dic):
    if(n in dic):
    return dic[n]
    arr = []
    frequency = int(math.sqrt(n))
    for i in range(frequency):
    i+=1
    arr.append(i)
    maxCount = -1
    for i in arr:
    count = self.num(n-(i*i),dic) # the argument is >=0 since i*i

  • @JangBahadur3028
    @JangBahadur3028 8 месяцев назад +1

    4:17 it would be 8. kindly add a hovering comment on the video, so that others get help.

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

    Bro, why didn't we use:
    fill(dp.begin(),dp.end(),-1); in this question? how to know where to use this and where to not use this?

    • @ujjawalhere4887
      @ujjawalhere4887 10 месяцев назад

      u can use everywhere but wherever u get wrong ans then try this

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

    nice plz continue

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

    Great vid!😀 #princebhai

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

    Bhaiya appki puri Stack/Queue, Graphs, heap or DP playlist karlu, thats enough to crack and coding interview?

  • @BobMarley-qh2qs
    @BobMarley-qh2qs Год назад

    bhai one question why did u declare the dp array outside the class , and yeah when i try to do the same thing inside the function i got a tle? is this related to memory allocation?

    • @amanraj7467
      @amanraj7467 9 месяцев назад

      Intialize dp vector in given function then it's work

  • @MalobikaNandy
    @MalobikaNandy 6 месяцев назад

    why am I getting TLE even after applying DP
    class Solution {
    static int dp[]=new int[10001];
    public int numSquares(int n) {
    Arrays.fill(dp,-1);
    return numSquaresHelper(n);
    }
    public int numSquaresHelper(int n) {
    if(n

  • @VaibhavSutar-xm3cn
    @VaibhavSutar-xm3cn 7 месяцев назад

    var numSquares = function(n) {
    let ans = 0
    let leastperfectSquares = 0
    for(let i = 2;i