Sir, I have been watching your videos regulary and because of that I was able to solve today's question all by myself. Thank you , because of your videos I am able to improve my problem solving
@codestorywithMIK Жыл бұрын
Apologies for the delay guys. Little busy this week due to festival. Hope you guys will understand ❤️❤️❤️
@kamleshsinghbisht130 Жыл бұрын
Eid Mubarak Bhai Jaan💓
@codestorywithMIK Жыл бұрын
Eid Mubarak Kamlesh. Thank you so much ❤️❤️❤️
@turing_machine544 Жыл бұрын
Eid Mubarak Bhaiya
@kamleshsinghbisht130 Жыл бұрын
@@codestorywithMIK Keep Up The Good Work!
@codestorywithMIK Жыл бұрын
Time Complexity :- O(N*M*K) N is the maximum number of criminals allowed in a scheme, M is the size of the list group, and K is the value of minProfit. Space Complexity :- O(N*M*K)
@ManojKrVerma-vw4dx Жыл бұрын
if v r nt memoising its time complexity is 2^N . Am I correct ?
@codestorywithMIK Жыл бұрын
Yes because at each position you have two choices. So TC is exponential
@anuppatankar4294 Жыл бұрын
Watched your explanation and solved it myself. Great Video ❤
@codestorywithMIK Жыл бұрын
Awesome Anup ❤️❤️❤️
@sanjaykatta6499 Жыл бұрын
I have almost solved a hard problem. Just got stuck at memoizing the third component profit, otherwise I almost did it. Thank you for all your explanations and intuition building. It would've never been possible otherwise.
@codewalalove8783 Жыл бұрын
Sir, apki vedio ka morning se wait kr rahe hai, i saw 3-4 vedio more before that of same question, but smj nhi aya. I really like your way of explaning the things.Thnak You :)
@codestorywithMIK Жыл бұрын
Awesome. So glad. Thank you so much ❤️❤️❤️
@niteshk0487 Жыл бұрын
question dekhne ke bd or read krne ke bd itna hard lga sb sir ke upr se gya after watching your explanation easy or wot🤣❤❤
@souravjoshi2293 Жыл бұрын
I see many videos, but the satisfaction comes from your videos. Thanks a lot Eid Mubarak
@codestorywithMIK Жыл бұрын
Thanks a lot Eid Mubarak ❤️❤️
@vineetkumar2899 Жыл бұрын
Thank you so much for this awesome explanation of hard problem. Eid Mubarak Bhaiya.💥💫
@codestorywithMIK Жыл бұрын
Thanks a lot Vineet ❤️❤️❤️
@k_CO_Sachin9 ай бұрын
Amazing the idea to take minimum.... I was stuck at this step
@iamnoob75934 ай бұрын
Again fantastic Explanation
@arjunsolanki2612 Жыл бұрын
Once again thank you bhaiya. Eid mubarak❤
@codestorywithMIK Жыл бұрын
Thanks a lot Eid Mubarak ❤️❤️
@shikharpandya49274 ай бұрын
Thank u sir did it on my own
@romanraihan9133 Жыл бұрын
long long not_taken = solve(i+1, p, people, minProfit, group, profit)%mod; long long taken = solve(i+1, min(p+profit[i], minProfit), people+group[i], minProfit, group, profit)%mod; we are doing mod here. so we don't need to do (taken%mod + not_taken%mod)%mod; only (taken + not_taken) %mod; should work. just a simple improvement. Thanks for the tutorial. I was waiting since 6am for this video.
@codestorywithMIK Жыл бұрын
Yep yep absolutely correct. Thanks a lot ❤️
@saurabhkumarsingh9550 Жыл бұрын
Nicely explained.... I am new to your channel... I must say your explanation is good.
@codestorywithMIK Жыл бұрын
Thank you so much Sourabh and welcome to my channel ❤️❤️
@prajwalshaw9217 Жыл бұрын
Thanks for a wonderful explanation sir. But facing a bit problem while coming up with it's bottom up approach...eagerly waiting for the bottom up approach of this question.
@kashishseth95584 күн бұрын
aapko sunne mai hi itna maja aa rhe hai , issi bahaane padhai bhi ho jayegi
@informative180 Жыл бұрын
u r too gud..❤
@codestorywithMIK Жыл бұрын
Thank you so so much
@manimanohar_001 Жыл бұрын
Bhaijaan Eid Mubarak🌛.
@codestorywithMIK Жыл бұрын
Eid Mubarak ❤️❤️❤️
@shaamidrees6036 Жыл бұрын
Thanks you brother
@codestorywithMIK Жыл бұрын
Thanks a lot Eid Mubarak ❤️❤️
@abc-ym4zs Жыл бұрын
I am your new subscriber I saw your channel in the linkedin saying u are approach to a problem is really good like on which topic your uploading questions dialy how to get maximum of your playlist how to follow your playlist sir
@codestorywithMIK Жыл бұрын
Thanks a lot. Welcome to my channel. Right now I post Leetcode Daily Challenge And if you checkout my channel, it has playlists for different topics. If you want to make Graph easy, you can start my “Graph Concepts & Qns” playlist.
@abc-ym4zs Жыл бұрын
@@codestorywithMIK ok sir
@anubhavsingla3126 Жыл бұрын
class Solution { int MOD = 1000000007; public int solve(int n, int p, int i, int[] group, int minProfit, int[] profit, int[][][] dp) { if(i == group.length) { return p >= minProfit ? 1 : 0; } if(dp[i][n][p] != -1) return dp[i][n][p]; int ans = 0; ans = solve(n, p, i+1, group, minProfit, profit, dp); if(n - group[i] >= 0) ans += solve(n - group[i], Math.min(p+profit[i], minProfit), i+1, group, minProfit, profit, dp); return dp[i][n][p] = ans % MOD; } public int profitableSchemes(int n, int minProfit, int[] group, int[] profit) { int[][][] dp = new int[group.length+1][n+1][minProfit+1]; for(int[][] row: dp) { for(int[] col: row) { Arrays.fill(col, -1); } } return solve(n, 0, 0, group, minProfit, profit, dp); } } java version of recur + memo
@Imrockonn Жыл бұрын
🎉
@codeandtalk6 Жыл бұрын
❤
@humanity7880 Жыл бұрын
That minProfit wala explanation was too good,but can you explain me one thing: before that i was trying to do by making a dp[101][101][10001] by assuming that maxProfit will be of 10000 because in question was given profit[i]'s max value is 100 and profit's max length is 100 so i take 100*100=10000 and +1 that makes it dp[101][101][10001] but that was not working. Am i right profit dows not exceed 10000?
@ManojKrVerma-vw4dx Жыл бұрын
why are u checking whether we found one way after reaching end of the array. Is it not correct to say as soon as we get one way we should increase the count by 1?
@codestorywithMIK Жыл бұрын
Because we want to explore different paths. And if we return as soon as we get minProfit, then we might miss other profitable paths from that point further
@ManojKrVerma-vw4dx Жыл бұрын
@@codestorywithMIK as soon as we get minProfit we increase the count by 1 and continue exploration further I never say return. I was doing the same and getting the answer always more than the actual answer. Why ?
@codestorywithMIK Жыл бұрын
Can you share your code
@codestorywithMIK Жыл бұрын
You need to ensure that you dont exceed the number of members greater than n
@ManojKrVerma-vw4dx Жыл бұрын
@@codestorywithMIK Here is my recursive code void helper(int idx, vector& group, vector& profit, int pprofit, int minProfit, int persons, int maxPersons, int sz, int &cnt){ if (idx >= sz) return ; if (pprofit >= minProfit and persons < maxPersons) cnt++; // option 1 leave this group helper(idx+1, group, profit, pprofit, minProfit, persons, maxPersons, sz, cnt); // select this group if possible if (persons+group[idx] = minProfit and persons < maxPersons) cnt++; return ; }
@Tech_Creater_ Жыл бұрын
Could you explain this question in dp tabular method ?
@codestorywithMIK Жыл бұрын
Sure. Will upload soon. Just a little occupied now due to festival
@naeemkhan4534 Жыл бұрын
Bro What do you use to record the videos? Which tablet and software
@codestorywithMIK Жыл бұрын
Ipad 11 pro I use default Notes app in it and use default screen recording
@YashSinghal Жыл бұрын
new mic ?🤔 Eid mubarak 🎉🌙
@codestorywithMIK Жыл бұрын
No new mic yet. But soon ❤️ Eid Mubarak ❤️❤️
@shivangiagrawal3971 Жыл бұрын
pls share today's daily leetcode question sooner
@codestorywithMIK Жыл бұрын
Hello Shivangi, Actually I couldn’t get time to post today’s leetcode due to festival. But feel free to find the code in my Github repo. And i will post tomorrow.
@shivangiagrawal3971 Жыл бұрын
@@codestorywithMIK ok Eid Mubarak ji apko
@codestorywithMIK Жыл бұрын
Thank you for understanding Shivangi. Eid Mubarak 😊
@atifhu Жыл бұрын
EID MUBARAK🌙
@codestorywithMIK Жыл бұрын
Eid Mubarak ❤️❤️
@AnkitSingh-tm5dp Жыл бұрын
I solve almost 90% but memo give some pain after understand the logic of min(profit+curr,miniproft) 🥲 i feel coding is really interesting thanku sir
@codestorywithMIK Жыл бұрын
So glad Ankit. 90% is all that I want. Soon very soon, we all will reach 100% together 💪💪💪 Thank you so much ❤️❤️❤️
@voice6905 Жыл бұрын
But I didn't understand why min(profit, profit[i] + currentProfit) works?