4:17 it would be 8. kindly add a hovering comment on the video, so that others get help.
@himanshusahu6879 Жыл бұрын
nice plz continue
@HelloWorldbyprince Жыл бұрын
Thanks a lot
@Lelkanta Жыл бұрын
Great vid!😀 #princebhai
@adityagoyal95564 ай бұрын
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
@umeshkaushik710 Жыл бұрын
Bhaiya appki puri Stack/Queue, Graphs, heap or DP playlist karlu, thats enough to crack and coding interview?
@Premierser Жыл бұрын
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?
@ujjawalhere488710 ай бұрын
u can use everywhere but wherever u get wrong ans then try this
@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?
@amanraj74678 ай бұрын
Intialize dp vector in given function then it's work
@MalobikaNandy6 ай бұрын
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-xm3cn7 ай бұрын
var numSquares = function(n) { let ans = 0 let leastperfectSquares = 0 for(let i = 2;i