Thank you so much for this video. What would be the brute-force recursive time complexity?
@paragroy53593 жыл бұрын
Nice explanation sir.....thanks for the video
@KnowledgeCenter3 жыл бұрын
Glad you liked it
@raviashwin11574 жыл бұрын
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?
@midhileshmomidi24344 жыл бұрын
Codeforces for Competitive programming and leetcode for interviews I felt codeforces problems are tougher than leetcode
@KnowledgeCenter4 жыл бұрын
Codforces ratings are not related to placements. For placements, LeetCode questions are more relevant.
@raviashwin11574 жыл бұрын
@@KnowledgeCenter Sir can you please make a video how to use leetcode effectively
@siddharthsingh43304 жыл бұрын
what is 1+dp[x-sq] doing I didn't understand properly?
@ijaz20204 жыл бұрын
Reconstruct Itinerary waiting for this video. I checked old videos now it is not there as well.
@KnowledgeCenter4 жыл бұрын
Have cramp in Neck and back. Was sleeping. Will try to add it before sleeping.
@mohammedshoaib16354 жыл бұрын
Great explanation!
@KnowledgeCenter4 жыл бұрын
Thanks!
@sehajverma69524 жыл бұрын
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
@KnowledgeCenter4 жыл бұрын
Exactly.
@mrlectus3 жыл бұрын
Any brute force solution?
@shubhakardebroy21114 жыл бұрын
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
@KnowledgeCenter4 жыл бұрын
Thanks for sharing.
@mukultaneja72434 жыл бұрын
I tried it's memoization, and it's faster than the tabulation. Please explain why...????