sir me to itna hi kahana chahunga or har baar kahna chahungA YOU are the best sir....!! aap jese logo ko upar aana chahiye aap 70 k nhi 700k desreve karte hain!!
Solved this question my own after doing "We have a choice" technique of yours. But was strugling to prepare dp as 'exp' could be negative. Your 'map as a dp' technique is just WOOW!
@@India_mera_sabkuch megativwe index wala chiz he bas alag , aur bhaiya s + kar rhe hai index me aap 1000 bhi plus kar sakte ho according to constraints
bhaiya ❤❤❤ today is a very special day .. idk aapko yad h ki nhi mne ek comment kiatha ki darr lag rha h bhaiya kahin placement lagegi ki nhi and a lot of things apne kaha tha ho jaiga ... aaj finally ho gya , finally got placed , interviewer was genuinely impressed by my problem solving skills aur m besharmo ki tarah 100 percent apki copy kar rha tha wahan . apki videos se daily potd karta hu bohot kuch sikha h aapse aur bhi bohot kuch sikhna baki h . last 1.5 years se daily apko follow karta hu aur karta rahunga
The sum can actually be -1, hence when you are filling it with the default value of -1 we would ignore some of the memoized values, the correct default value for the memoized array/list should be -1 * (sum of nums +1)
I am passing mostly tests for placements, and getting shortlist for interviews. But I am not able to pass interview till now, sometime after HR round i am getting rejected. I am not giving up, but somewhere my mind is getting it that interview are hard for me. definitely I will never give up in future on anything and i cant give up. But i want to pass the interview now. I will be getting interviews in January, mostly interviewers are saying that explanation is the problem. can you make 2-3 videos on interviews related your experience. It will be helpful.
this is how i solved this question sir : class Solution { public: int n; int t[21][2001]; int solve(int i,vector& nums,int target){ if(i >= n){ if(target == 0){ return 1; } else{ return 0; } } if(target>=0){ if(t[i][target] != -1){ return t[i][target]; } } else{ if(t[i][abs(target)+1000] != -1){ return t[i][abs(target)+1000]; } } int take = solve(i+1,nums,target-nums[i]); int notTake = solve(i+1,nums,target); if(target>=0){ return t[i][target] = take + notTake; } return t[i][abs(target)+1000] = take + notTake;
} int findTargetSumWays(vector& nums, int target) { n = nums.size(); int totalSum = 0; for(auto& num : nums){ totalSum += num; } if(target > abs(totalSum) || (totalSum+target)%2 != 0){ return 0; }
int newtarget = (totalSum+target)/2; memset(t,-1,sizeof(t));
Thanks for sharing such valuable information! Could you help me with something unrelated: I have a SafePal wallet with USDT, and I have the seed phrase. (alarm fetch churn bridge exercise tape speak race clerk couch crater letter). How can I transfer them to Binance?
public int findTargetSumWays(int[]nums,int target){ int sum=Arrays.stream(nums).sum(); if(sum=num;++i) dp[i]+=dp[i-num]; return dp[target]; } one query many yutuber say that in 2025 ma hiring ma dsa ka weighted kam hoga and development ka weighted jayada hoga?🎉❤
Try DP concepts playlist where I have explained these in details. Link - ruclips.net/p/PLpIkg8OmuX-JhFpkhgrAwZRtukO0SkwAt&si=XkEKTsJXXNv-gF3c Hope this helps ❤️🙏
I have doubt in word ladder 2 question, everything fits here for a graph and bfs approach with relation on connection with 1 letter off and queue up with the paths, but i always get MLE, memory limit issue. Other vids are there are with the wildcards, can you make a video on this?
I solved this problem at first glance super easily because of you bhaiya ❤. But was not able to memoize and was scratching my head. The moment you say that currSum can go negative, I got instant thought to shift the range. I did t[index][currSum + 1000) and was thinking super proud that I cracked it. But after you told that we can even optimize the space more, Hats off bhaiya 🔥🔥. It can never be possible that we will not learn something new in every video. 🫡
sir me to itna hi kahana chahunga or har baar kahna chahungA YOU are the best sir....!! aap jese logo ko upar aana chahiye aap 70 k nhi 700k desreve karte hain!!
This means a lot to me ❤️🙏
Yeah dude , hes great
but why only 700k xD LOL
@@manthansharma6769 Must be Millions right 😍
Solved this question my own after doing "We have a choice" technique of yours.
But was strugling to prepare dp as 'exp' could be negative. Your 'map as a dp' technique is just WOOW!
Easy done today MIK. Thank you.
Please also continue DP on grids.
23:37 This is called integer normalization method. It is used in count sort when encounted negetive values.
i just love the part where you motivate 💚
2nd way of memoization, just blow my mind 🙌🔥
Bro MIK can you explain leetcode 3235 . I think it's one of the really good questions on graph
Mik bhaiyya DP ka playlist karna baki hai abhi but aapki recursion playlist kar raha tha usi ke knowledge se DP ka question solve kar diya
Wow that’s amazing 😎🔥
MIK, when do you rest
Please never stop making videos
Hey mik today I just found that you can build 2d map like unordered_map t;
And we can push value just like array t[index][sum] = plus + minus;
Yes you are absolutely right! That’s a great way 🙏❤️
Bruh I admire your persistence!! Damn you are an inspiration!!
Good Explaination
Today POTD is solved before this video seen I flow you DP CONCEPT AND QUESTION WALA PLAYLIST PLEASE CONTINUE THIS PLAYLIST AS SOON AS POSSIBLE
really amazing bhaiya ❤❤
did this on my own , though easy one
han but memoization dry run hota to jyada samjh aat abhi nhi aa rha!!
@@India_mera_sabkuch megativwe index wala chiz he bas alag , aur bhaiya s + kar rhe hai index me aap 1000 bhi plus kar sakte ho according to constraints
That's something amazing bhaiya ❤
superb explanation as always btw you do not need memoization the constraints are low enough
You're right! ❤️
For this problem, memoization isn't necessary because of the constraint size. But it's a good practice for larger problems.
bhaiya ❤❤❤ today is a very special day .. idk aapko yad h ki nhi mne ek comment kiatha ki darr lag rha h bhaiya kahin placement lagegi ki nhi and a lot of things apne kaha tha ho jaiga ...
aaj finally ho gya , finally got placed , interviewer was genuinely impressed by my problem solving skills aur m besharmo ki tarah 100 percent apki copy kar rha tha wahan . apki videos se daily potd karta hu bohot kuch sikha h aapse aur bhi bohot kuch sikhna baki h . last 1.5 years se daily apko follow karta hu aur karta rahunga
Wow. Many Many Congratulations 🎊🎊❤️❤️
So happy to hear this.
The sum can actually be -1, hence when you are filling it with the default value of -1 we would ignore some of the memoized values, the correct default value for the memoized array/list should be -1 * (sum of nums +1)
Noice explanation!!!!!!!
Discuss bottom up and space optimized code also
first 🔥
sir , contest ka bhi question karaiye n , please 🙏🙏
I am passing mostly tests for placements, and getting shortlist for interviews. But I am not able to pass interview till now, sometime after HR round i am getting rejected. I am not giving up, but somewhere my mind is getting it that interview are hard for me. definitely I will never give up in future on anything and i cant give up. But i want to pass the interview now. I will be getting interviews in January, mostly interviewers are saying that explanation is the problem.
can you make 2-3 videos on interviews related your experience. It will be helpful.
Hi MIK, you didn't posted approach-1 using map in Java on Github..
Thanks for pointing that out! 🙏 I have added now. ❤️🙏
@codestorywithMIK Thank you.
this is how i solved this question sir :
class Solution {
public:
int n;
int t[21][2001];
int solve(int i,vector& nums,int target){
if(i >= n){
if(target == 0){
return 1;
}
else{
return 0;
}
}
if(target>=0){
if(t[i][target] != -1){
return t[i][target];
}
}
else{
if(t[i][abs(target)+1000] != -1){
return t[i][abs(target)+1000];
}
}
int take = solve(i+1,nums,target-nums[i]);
int notTake = solve(i+1,nums,target);
if(target>=0){
return t[i][target] = take + notTake;
}
return t[i][abs(target)+1000] = take + notTake;
}
int findTargetSumWays(vector& nums, int target) {
n = nums.size();
int totalSum = 0;
for(auto& num : nums){
totalSum += num;
}
if(target > abs(totalSum) || (totalSum+target)%2 != 0){
return 0;
}
int newtarget = (totalSum+target)/2;
memset(t,-1,sizeof(t));
return solve(0,nums,newtarget);
}
};
Sir can you please explain the tc ??
I am getting confused why it is O(n * sum(nums))
🔥++
I did solve these problems but I can't build the intuition ......
Thanks for sharing such valuable information! Could you help me with something unrelated: I have a SafePal wallet with USDT, and I have the seed phrase. (alarm fetch churn bridge exercise tape speak race clerk couch crater letter). How can I transfer them to Binance?
first watch
public int findTargetSumWays(int[]nums,int target){
int sum=Arrays.stream(nums).sum();
if(sum=num;++i)
dp[i]+=dp[i-num];
return dp[target];
}
one query many yutuber say that in 2025 ma hiring ma dsa ka weighted kam hoga and development ka weighted jayada hoga?🎉❤
14:12 😂 Code hai ya Bomb.
Tabulation bhi bata dete sir !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
bro could you plz solve leetcode question number 3398 if u have time
sir please solve leetcode problem no. 2127
hey can you do 3348 on leetcode once
Memoization , every time I mispronounce this word 😅
Memoization samajh nahi aata, please make few videos to help us understand memoization
Try DP concepts playlist where I have explained these in details.
Link - ruclips.net/p/PLpIkg8OmuX-JhFpkhgrAwZRtukO0SkwAt&si=XkEKTsJXXNv-gF3c
Hope this helps ❤️🙏
I have doubt in word ladder 2 question, everything fits here for a graph and bfs approach with relation on connection with 1 letter off and queue up with the paths, but i always get MLE, memory limit issue. Other vids are there are with the wildcards, can you make a video on this?
I solved this problem at first glance super easily because of you bhaiya ❤. But was not able to memoize and was scratching my head. The moment you say that currSum can go negative, I got instant thought to shift the range. I did t[index][currSum + 1000) and was thinking super proud that I cracked it. But after you told that we can even optimize the space more, Hats off bhaiya 🔥🔥. It can never be possible that we will not learn something new in every video. 🫡
That's amazing!