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

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

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
@siddharthsingh4330
@siddharthsingh4330 4 жыл бұрын
what is 1+dp[x-sq] doing I didn't understand properly?
@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
@mrlectus
@mrlectus 3 жыл бұрын
Any brute force solution?
@mohammedshoaib1635
@mohammedshoaib1635 4 жыл бұрын
Great explanation!
@KnowledgeCenter
@KnowledgeCenter 4 жыл бұрын
Thanks!
@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.
@mukultaneja7243
@mukultaneja7243 4 жыл бұрын
I tried it's memoization, and it's faster than the tabulation. Please explain why...????
@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.
@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.
Minimum Cost For Tickets | LeetCode 983 | C++, Java, Python
18:38
Knowledge Center
Рет қаралды 14 М.
Perfect Squares - Dynamic Programming - Leetcode 279 - Python
15:12
Non-overlapping Intervals | LeetCode 435 | C++, Java, Python
20:35
Knowledge Center
Рет қаралды 7 М.
Reconstruct Itinerary | LeetCode 332 | C++, Java, Python
35:12
Knowledge Center
Рет қаралды 6 М.
I gave 127 interviews. Top 5 Algorithms they asked me.
8:36
Sahil & Sarra
Рет қаралды 667 М.
Dungeon Game | LeetCode 174 | Dynamic Programming | C++, Java, Python
23:59
8 Data Structures Every Programmer Should Know
17:09
ForrestKnight
Рет қаралды 146 М.