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

แชร์
ฝัง
  • เผยแพร่เมื่อ 14 ต.ค. 2024
  • In this video on Recursion and DP, part of the DATA STRUCTURE & ALGORITHM series, we will solve a Problem stated as the "Perfect Squares" by using Recursion and Memoization in DP.
    Join My Telegram channel for more Updates: telegram.me/he...
    complete DSA preparation: github.com/Pri...
    Enhance your programming skills with our comprehensive courses on Competitive Programming, Data Structures, and Algorithms. Check out our Channel's Full Playlist to elevate your coding abilities!
    ----------------------------------------------------------------------------------------
    🟠 279. Perfect Squares
    Given an integer n, return the least number of perfect square numbers that sum to n.
    A perfect square is an integer that is the square of an integer; in other words, it is the product of some integer with itself. For example, 1, 4, 9, and 16 are perfect squares while 3 and 11 are not.
    Input: n = 12
    Output: 3
    Explanation: 12 = 4 + 4 + 4.
    🟣 Perfect Squares: leetcode.com/p...
    🟢 Code in this video: github.com/Pri...
    🟡 Pdf in this video: github.com/Pri...
    ----------------------------------------------------------------------------------------
    Follow me on:
    💼 LinkedIn► / iamprince
    📷 Instagram► / helloworldbyprince
    🐦 Twitter► / prince_king_
    📲 Telegram► telegram.me/he...
    📘 Facebook► / helloworldofficials
    ----------------------------------------------------------------------------------------
    ►Our Playlists on:-
    🔥 Tree: • Tree Data Structure & ...
    🔥 Stack & Queue: • Stack & Queue Data Str...
    🔥 Hashing: • Hashing Data Structure...
    🔥 Graph: • Graph Data Structure &...
    🔥 Matrix: • Matrix (Multidimension...
    🔥 Recursion & DP: • Recursion
    🔥 Heap: • Heap Data Structure & ...
    🔥 Linked List: • Linked List Data Struc...
    🔥 STL: • Standard Template Libr...
    🔥 Leetcode: • LeetCode Solutions And...
    🔥Competitive Programming: • Full course in Competi...
    🔥 C++ Full Course: • C++ full Course in HINDI
    🔥 Algorithms: • L-01 || Prefix Sum Arr...
    🔥 Data Structure: • Data Structures with C...
    ------------------------------------------------------------------------
    🌟 Please leave a LIKE ❤️ and SUBSCRIBE for more AMAZING content! 🌟
    ✨ Tags ✨
    Perfect Squares
    Recursive playlist
    Recursive solution
    Recursion programming
    Recursive Function
    Programming tutorials
    Coding challenges
    Number reversal
    Math problems
    Algorithm design
    Data structures and algorithms
    Computer science education
    Software development
    Beginner programming
    complete recursion playlist
    Coding tips and tricks
    C++ programming
    Coding projects
    Problem-solving techniques
    C++ programming
    Data structures and algorithms
    Recursive functions
    Recursive approach
    Divide and conquer
    Computer science
    Programming tutorials
    Educational videos
    Beginner programming
    Coding challenges
    Software engineering
    Algorithm Design
    C++ Programming Basics
    C++ Syntax
    C++ Functions
    Recursive Functions
    Coding Tutorials
    Programming languages
    Computer science
    Computer programming
    Recursive functions
    Problem-solving techniques
    Software engineering
    Hello World
    programming
    coding
    tutorials
    tech
    software development
    beginner programming
    coding for beginners
    programming tips and tricks
    software engineering
    coding tutorials
    web development
    programming languages
    coding challenges
    coding projects
    software design
    coding bootcamps
    coding resources
    C++ programming basics
    C++ syntax
    C++ functions
    Computer science education
    Beginner programming tutorials
    Educational videos
    solve leetcode problems
    solving leetcode problems in python
    solving leetcode problems c++
    solving leetcode questions
    solving all leetcode problems
    unable to solve leetcode problems
    how to solve leetcode questions
    solve the equation leetcode
    #recursion #geeksforgeeks #programming
    Comment "#Princebhai" if you read this 😉😉

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

  • @adityagoyal9556
    @adityagoyal9556 3 หลายเดือนก่อน

    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

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

    Best vid on TH-cam

  • @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 9 หลายเดือนก่อน

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

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

    Great Explaination, Thanks alot🙂

  • @umeshkaushik710
    @umeshkaushik710 11 หลายเดือนก่อน

    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 8 หลายเดือนก่อน

      Intialize dp vector in given function then it's work

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

    nice plz continue

  • @MalobikaNandy
    @MalobikaNandy 5 หลายเดือนก่อน

    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

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

    Great vid!😀 #princebhai

  • @VaibhavSutar-xm3cn
    @VaibhavSutar-xm3cn 6 หลายเดือนก่อน

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