A note to myself (CPP implementation) //WHY WE NEED THIS HELPER() fn AGAIN //When you notice, //We HAVE to find exactly k distinct vals //We know atmost one is easier. //Doing Atmost Technique (k (-) k-1) //we get to our answer efficiently //As for counting total no of subarr //why we doing count += (j-i+1) ? //cuz if we do a dry run, we observe this only #include int helper(vector&arr, int n, int k){ //This is basically //finding total subarr with atmost k distinct int unordered_map mp; int i=0, j=0, count=0; while(j
@muditkhandelwal20087 ай бұрын
I watched neetcode video but couldn't understand the solution. This video saved the day. Thanks.
@amanjain66432 жыл бұрын
This is one of the clearest and most detailed explanations for this problem. Kudos to you Alisa.
@dasaridharani652911 ай бұрын
True
@piragna58027 ай бұрын
I hav reached minute 1:42 and I am alreazy amazed because of the expalantion, thank you su much! you´re amazing!
@piragna58027 ай бұрын
😊
@Yash61892 жыл бұрын
Alisha, good work, you're the only one who not only describes the intuition but also explains why and how it works! 💯
@PRINCEKUMAR-ml9tb Жыл бұрын
Just Phenomenal! One of the best explanation of this problem.
@kusumjoshi46137 ай бұрын
This is one of the best explanations I have seen soo far.
@krishnasingh2520 Жыл бұрын
Brilliant explanation Ma'am. I was stuck on this Question for a while but the way you dry ran the code helped me understand the code. And i was able to code it myself🙏🏽⭐
@technologicalvivek751011 ай бұрын
Nice explanation.Thank you didi .I got stuff to solve this question.After spending a lot of time.Thanks finally I understand the correct approach behind this question.
@Anuragkumar-dc1dr2 жыл бұрын
what an explanation! you have solved problem logically. And also understand concept behind writing every line of code . Thank You Alisha
@shashankbankar1845 Жыл бұрын
God level explained , I simply can't thank you enough, please continue making such videos, you are awesome..
@omkarkawatgi2 жыл бұрын
Yar ye hota hai explanation... bahut sahi ! Thank you ...
@mrinalmadhav81193 жыл бұрын
Mam u r beauty with brain
@Inndjkaawed2922 Жыл бұрын
WTF dude?
@ShardulPrabhu7 ай бұрын
Sudhar ja padhai kr
@rutikdeshmukh9373 Жыл бұрын
wowww, very intutive technique and detailed explanation!! thanks
@gowrisankar98jammu49 Жыл бұрын
Awesome explanation 👏 👌 👍
@preethi9087 Жыл бұрын
mam ur explanation is awesome .thank u
@awesomesheen Жыл бұрын
Amazing intuition! Best video on this question I have seen!
@saketmehta6697 Жыл бұрын
One of the best explanation for this hard problem! Watch this video guys you'll be able to solve many problems of sliding window! Kudos alisha! Hats OFF!
@rachakondaeshwar41295 ай бұрын
Beautiful explanation.
@Sanjaysview10 ай бұрын
Yo, that was smooth explanation. Thanks Sister!!
@sukhpreetsingh5200 Жыл бұрын
Awesome explaination
@sujayshanbhag2055 Жыл бұрын
Best explanation ever.
@manishisaxena5657 Жыл бұрын
bhut pyara samjhaya hai aapne thankyou.
@niteshgupta11182 жыл бұрын
Amazing explanation. Was struggling on this question from so many hours.
@PiyushKatare-z6u7 ай бұрын
great explanation
@Komedy1Reels Жыл бұрын
wooow, in leetcode this question is marked as hard, i spent whole day to figure out how to solve this but i failed, after seeing your approach, i felt like this is "this one so simple", Thank you so much for the vd and ur explanation is really good, I am gonn post this vd on leetcode😅
@souviknandi92982 жыл бұрын
Thank you🙇♂ The most under rated youtuber.
@soumyajitmishra6855 Жыл бұрын
Thank you ... beautifully explained
@RassieVanderDussen-mc8um Жыл бұрын
Very Good Explanation
@itsaryanb93168 ай бұрын
perfectly explained, thank you :)
@anuragtiwari30322 жыл бұрын
Came for 1 question learnt 2. Excellent work , wish ur channel to explode 🔥
@sahnawazshaban123411 ай бұрын
superb explanation; keep growing😊
@yaswanthkosuru2 жыл бұрын
you r time taken to solve 72 min i think i am only one who take 2 hrs ,3 hrs to slove problems
@IndieDeveloperGuy Жыл бұрын
Thankyou so much , i was stuck on this question for a really long time.
@ameygadhe6437 Жыл бұрын
Damn girl you smart.
@ursawarior4ever2 жыл бұрын
wow watched two other videos that made no sense and now i get it, THANK YOU
@mitrraaswin4933 Жыл бұрын
Great explanation madam! And I got this exact question from an interview. I was able to explain the logic but getting the code run in O(n) complexity wasn't easy for me. But informative video as always
@pragneshamadavadi2267 Жыл бұрын
GEM 🔥🔥
@NaveenKumar-os8dv2 жыл бұрын
I know you don't have many subscribers and views, but your explanation is great, whenever I am stuck at some point, you come as an angel to resolve my query. Keep doing this. There is just one problem, this code is at faster than 5% ( more than 100 ms) in leetcode. which means it is slow for some reason. Some other solution without the MAP (and only new arr[n+1]) runs faster. (faster than 90%) 4 to 10 ms run. Can you please make video for that method too, please....I want to really understand, but I am unable too, please make video on it.
@probabilitycodingisfunis12 жыл бұрын
I appreciate that! Thanks
@chintanpatel93042 жыл бұрын
Nice explanation. Thanks for the solution
@prasantdas7182 Жыл бұрын
Great explanation🔥
@soumakdalapati20262 жыл бұрын
thanks for the video....great explanation !!!..🙏🙏
@sunilbhenspaliya99312 жыл бұрын
simple and best explained .thank you so much alisha
@probabilitycodingisfunis12 жыл бұрын
Glad it was helpful!
@mihirsagar27152 жыл бұрын
This is GOD level explanation
@pranshuadhwaryu6374 Жыл бұрын
Alisha dii keep going 💪🔥
@OMPRAKASH-fh3so2 жыл бұрын
Nice Explanation.
@gremlan6419 Жыл бұрын
Nice explanation
@kmanju68542 жыл бұрын
Perfect explanation
@asjadahmedkhan96612 жыл бұрын
Just Amazing !!! The expiation is very very good!!. Keep up the good work.
@mahimahesh50947 ай бұрын
Thank you alisa
@priyankamishra57042 жыл бұрын
Well explained! finally understood the logic.
@rankitgujjar802 жыл бұрын
crystal clear explanation as always 🙇♂🙇♂
@mohitkumar5572 жыл бұрын
very easy logic to understand
@guptagaurav9162 жыл бұрын
The easiest to interpret. Thank you !
@ranitdey73692 жыл бұрын
Really amazing explanation. Awesome ❤️!
@manup76363 жыл бұрын
Beauty with brains.
@digambardiwakar9535 Жыл бұрын
thankyou so much
@vermadeepak846 ай бұрын
what about finding all subarrays with unique elements? i.e., with no threshold
@tarunmali62282 жыл бұрын
Great explanation!!!
@ShadabKhan-o2u Жыл бұрын
Best
@atchaiyarajsaravanan Жыл бұрын
amazing video! please change the title to "subarrays with k distinct integers"
@Nitishkumar-rd4jq2 жыл бұрын
the answer i am waiting looking for!!!!!!!
@karthik40612 жыл бұрын
Great work Keep going!!! :)
@AayushDubey_007 Жыл бұрын
In gfg , my Test Cases are stuck at 11024 /11027 or 11026/11027 (TLE) , what optimisation can be done?
@vamshisamineniz59052 жыл бұрын
good explanation
@probabilitycodingisfunis12 жыл бұрын
Thank you so much
@cricketsureshlucky9 ай бұрын
mam please explain me when we are counting subarrays 1 is counted twice 1 at index 0 with size one and 1 at index 3 with size 1 at 4:30
@arunmurukesh28302 жыл бұрын
Good job ma...
@fpol8902 жыл бұрын
Hello, do you offer tutoring by any chance?
@GoluYadav-cg3kx2 жыл бұрын
isn't it expensive to use erase method for map, we can take an integer to keep track of unique elements
@franciskp91178 ай бұрын
Seeing all those tabs....my laptop just stopped working
@saktagan282 жыл бұрын
like and subscription) I have question what is the name of the formula -> exactly(K) = atMost(K) - atMost(K-1) and where I can read about it more, cause I can not find it in internet Thanks)
@mathematics61992 жыл бұрын
Dude, in atmost K, you will get this expression write-> exactly(1) + exactly(2) + ..... exactly(k), similarly for atmost (k-1) you will get exactly(1) + exactly (2) + .... exactly (k-1) just subtract these two. you will get exactly(k). Now don't ask why atmost k expression is the above expression.
@CodingNinja-f7k2 ай бұрын
what if the value of k=1
@RohitKumar-dy2gc Жыл бұрын
so easy i code by myself
@deeprealanalysis1407 Жыл бұрын
provide code as well
@vaibhavverma1340 Жыл бұрын
please solve this using python !!
@nikunjgupta28782 жыл бұрын
your code fail when value of k==1
@md.sahidulislam3152 Жыл бұрын
//where is the wrong...please help me unordered_mapmp; int n=nums.size(); int i=0,count=0; for(int j=0; jk){ mp[nums[i]]--; if(mp[nums[i]]==0){ mp.erase(nums[i]); } i++; } count +=(j-i+1); } return count;