Came here for linear approach. What a fine explanation π₯π₯π₯
perfect way ,,, "teach how to catch fish instead of giving fish...". you are Teaching
Just wanted to say thank you! You are truly awesome. I've been watching your videos for the past 5 days, and the way you explain and simplify problems is simply amazing. Itβs helped me so much in understanding how to approach problems better. Truly grateful for your content!
man, i tell you one thing... i used to hate DSA... it was like a burden to me but now because of you, slowly but surely i am starting to enjoy it... i am loving solving DSA problems every day and it has become like a routine for me... thank you sooo much!!
Speechless after watching this masterpiece explanation β€β€β€β€
Thank you mik, these detailed explanations are what makes me think better.
Amazing explanation, what's more impressive is the logic and how easily you have explained it
O(1) Approach π±π± class Solution { const int MOD = 1e9 + 7; long long C(long long n) { if (n < 0) return 0; return (n * (n - 1)) / 2; } public: long long distributeCandies(int n, int limit) { long long total = C(n + 2 + 1); // C(n+2, 2) long long over1 = 3 * C(n - limit - 1 + 2 + 1); // each child > limit long long over2 = 3 * C(n - 2 * (limit + 1) + 2 + 1); // any two > limit long long over3 = C(n - 3 * (limit + 1) + 2 + 1); // all three > limit long long ans = total - over1 + over2 - over3; return max(0LL, ans); // ensure non-negative } };
bhaiya from today i started my dsa journey and saw your this video and just feeling dumb ;what a video- mindblowing ; i will come back you to comment my journey update .
highly appreciate your efforts and dedication π
You earned a fan today . Great explanation mate β€
This marks my 2 days streak. I have started after so many months and hope I will continue it in the coming days.
Bhai , you have amazing skill of teaching .
thank you sir your channel is way too underrated i will tell about this channel to my college friends finally understood this question, i was on solution tab of leetcode and was not understanding any solution at the same time your channel was suggested in out leetcoders whatsapp group after that i came here for the solution explanation and this 40 min was worth it π
Bhaiya , you are really a motivation and inspiration for me.
Thank you so much, love the way of your explanation. This is real DSA.
Hey Mik, it would be great if you could share us the pdfs of the iPad notes it will definitely make the revision easier of these type of Questions which students are not being able to handle on the first go!
Best explanation ππ» make every thing so much easy and clear
Leetcode weekly contest qn.no.4 segment tree is best problem please make video πβ€
@codestorywithMIK