Perfect Squares | LeetCode 279 | C++, Java, Python

  Рет қаралды 9,930

Knowledge Center

Knowledge Center

Күн бұрын

Пікірлер: 20
@srinish1993
@srinish1993 4 жыл бұрын
11:26 integration explanation was 👌
@KnowledgeCenter
@KnowledgeCenter 4 жыл бұрын
Thanks.
@crisag.2698
@crisag.2698 4 жыл бұрын
Thank you so much for this video. What would be the brute-force recursive time complexity?
@paragroy5359
@paragroy5359 3 жыл бұрын
Nice explanation sir.....thanks for the video
@KnowledgeCenter
@KnowledgeCenter 3 жыл бұрын
Glad you liked it
@raviashwin1157
@raviashwin1157 4 жыл бұрын
Respected sir,which is better platform to code in leetcode or codeforces,will it be making any difference in placement if i just code in leetcode but not in codeforces.Is codeforces rating needs to be too good to grab good placement?
@midhileshmomidi2434
@midhileshmomidi2434 4 жыл бұрын
Codeforces for Competitive programming and leetcode for interviews I felt codeforces problems are tougher than leetcode
@KnowledgeCenter
@KnowledgeCenter 4 жыл бұрын
Codforces ratings are not related to placements. For placements, LeetCode questions are more relevant.
@raviashwin1157
@raviashwin1157 4 жыл бұрын
@@KnowledgeCenter Sir can you please make a video how to use leetcode effectively
@siddharthsingh4330
@siddharthsingh4330 4 жыл бұрын
what is 1+dp[x-sq] doing I didn't understand properly?
@ijaz2020
@ijaz2020 4 жыл бұрын
Reconstruct Itinerary waiting for this video. I checked old videos now it is not there as well.
@KnowledgeCenter
@KnowledgeCenter 4 жыл бұрын
Have cramp in Neck and back. Was sleeping. Will try to add it before sleeping.
@mohammedshoaib1635
@mohammedshoaib1635 4 жыл бұрын
Great explanation!
@KnowledgeCenter
@KnowledgeCenter 4 жыл бұрын
Thanks!
@sehajverma6952
@sehajverma6952 4 жыл бұрын
Just interpret this question as Coin change problem with infinite number of same denomination coins. class Solution { public: int numSquares(int n) { int x = sqrt(n); int dp[x+1][n+1]; memset(dp,0,sizeof(dp)); int m=INT_MAX; for(int i=1;i
@KnowledgeCenter
@KnowledgeCenter 4 жыл бұрын
Exactly.
@mrlectus
@mrlectus 3 жыл бұрын
Any brute force solution?
@shubhakardebroy2111
@shubhakardebroy2111 4 жыл бұрын
According to Lagrange's four square theorem we can solve this in O(N) www.geeksforgeeks.org/lagranges-four-square-theorem/ Solution in python: def numSquares(self, n): sqr = sqrt(n) pool = {i**2 for i in range(int(sqr)+1)} test = [i**2 for i in range(int(sqr*0.71)+1)] for i in test: for j in test: if n-i-j in pool: return 3-(i==0)-(j==0) return 4
@KnowledgeCenter
@KnowledgeCenter 4 жыл бұрын
Thanks for sharing.
@mukultaneja7243
@mukultaneja7243 4 жыл бұрын
I tried it's memoization, and it's faster than the tabulation. Please explain why...????
Reconstruct Itinerary | LeetCode 332 | C++, Java, Python
35:12
Knowledge Center
Рет қаралды 6 М.
How Much Tape To Stop A Lamborghini?
00:15
MrBeast
Рет қаралды 235 МЛН
Noodles Eating Challenge, So Magical! So Much Fun#Funnyfamily #Partygames #Funny
00:33
Perfect Squares - Dynamic Programming - Leetcode 279 - Python
15:12
Minimum Cost For Tickets | LeetCode 983 | C++, Java, Python
18:38
Knowledge Center
Рет қаралды 14 М.
Edit Distance | Dynamic Programming | LeetCode 72 | C++, Java, Python
27:22
5 Simple Steps for Solving Dynamic Programming Problems
21:27
Reducible
Рет қаралды 1,1 МЛН
Word Break ii | LeetCode 140 | C++, Python
19:50
Knowledge Center
Рет қаралды 19 М.
[Java] Leetcode 279. Perfect Squares [DP Integer Partition #2]
11:08
Eric Programming
Рет қаралды 2,3 М.
C Programming Tutorial for Beginners
3:46:13
freeCodeCamp.org
Рет қаралды 14 МЛН
I gave 127 interviews. Top 5 Algorithms they asked me.
8:36
Sahil & Sarra
Рет қаралды 674 М.
How Much Tape To Stop A Lamborghini?
00:15
MrBeast
Рет қаралды 235 МЛН