Subarrays with distinct integers

  Рет қаралды 35,548

Code with Alisha

Code with Alisha

Күн бұрын

Пікірлер: 93
@phantom3612
@phantom3612 11 ай бұрын
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
@muditkhandelwal2008
@muditkhandelwal2008 7 ай бұрын
I watched neetcode video but couldn't understand the solution. This video saved the day. Thanks.
@amanjain6643
@amanjain6643 2 жыл бұрын
This is one of the clearest and most detailed explanations for this problem. Kudos to you Alisa.
@dasaridharani6529
@dasaridharani6529 11 ай бұрын
True
@piragna5802
@piragna5802 7 ай бұрын
I hav reached minute 1:42 and I am alreazy amazed because of the expalantion, thank you su much! you´re amazing!
@piragna5802
@piragna5802 7 ай бұрын
😊
@Yash6189
@Yash6189 2 жыл бұрын
Alisha, good work, you're the only one who not only describes the intuition but also explains why and how it works! 💯
@PRINCEKUMAR-ml9tb
@PRINCEKUMAR-ml9tb Жыл бұрын
Just Phenomenal! One of the best explanation of this problem.
@kusumjoshi4613
@kusumjoshi4613 7 ай бұрын
This is one of the best explanations I have seen soo far.
@krishnasingh2520
@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🙏🏽⭐
@technologicalvivek7510
@technologicalvivek7510 11 ай бұрын
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-dc1dr
@Anuragkumar-dc1dr 2 жыл бұрын
what an explanation! you have solved problem logically. And also understand concept behind writing every line of code . Thank You Alisha
@shashankbankar1845
@shashankbankar1845 Жыл бұрын
God level explained , I simply can't thank you enough, please continue making such videos, you are awesome..
@omkarkawatgi
@omkarkawatgi 2 жыл бұрын
Yar ye hota hai explanation... bahut sahi ! Thank you ...
@mrinalmadhav8119
@mrinalmadhav8119 3 жыл бұрын
Mam u r beauty with brain
@Inndjkaawed2922
@Inndjkaawed2922 Жыл бұрын
WTF dude?
@ShardulPrabhu
@ShardulPrabhu 7 ай бұрын
Sudhar ja padhai kr
@rutikdeshmukh9373
@rutikdeshmukh9373 Жыл бұрын
wowww, very intutive technique and detailed explanation!! thanks
@gowrisankar98jammu49
@gowrisankar98jammu49 Жыл бұрын
Awesome explanation 👏 👌 👍
@preethi9087
@preethi9087 Жыл бұрын
mam ur explanation is awesome .thank u
@awesomesheen
@awesomesheen Жыл бұрын
Amazing intuition! Best video on this question I have seen!
@saketmehta6697
@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!
@rachakondaeshwar4129
@rachakondaeshwar4129 5 ай бұрын
Beautiful explanation.
@Sanjaysview
@Sanjaysview 10 ай бұрын
Yo, that was smooth explanation. Thanks Sister!!
@sukhpreetsingh5200
@sukhpreetsingh5200 Жыл бұрын
Awesome explaination
@sujayshanbhag2055
@sujayshanbhag2055 Жыл бұрын
Best explanation ever.
@manishisaxena5657
@manishisaxena5657 Жыл бұрын
bhut pyara samjhaya hai aapne thankyou.
@niteshgupta1118
@niteshgupta1118 2 жыл бұрын
Amazing explanation. Was struggling on this question from so many hours.
@PiyushKatare-z6u
@PiyushKatare-z6u 7 ай бұрын
great explanation
@Komedy1Reels
@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😅
@souviknandi9298
@souviknandi9298 2 жыл бұрын
Thank you🙇‍♂ The most under rated youtuber.
@soumyajitmishra6855
@soumyajitmishra6855 Жыл бұрын
Thank you ... beautifully explained
@RassieVanderDussen-mc8um
@RassieVanderDussen-mc8um Жыл бұрын
Very Good Explanation
@itsaryanb9316
@itsaryanb9316 8 ай бұрын
perfectly explained, thank you :)
@anuragtiwari3032
@anuragtiwari3032 2 жыл бұрын
Came for 1 question learnt 2. Excellent work , wish ur channel to explode 🔥
@sahnawazshaban1234
@sahnawazshaban1234 11 ай бұрын
superb explanation; keep growing😊
@yaswanthkosuru
@yaswanthkosuru 2 жыл бұрын
you r time taken to solve 72 min i think i am only one who take 2 hrs ,3 hrs to slove problems
@IndieDeveloperGuy
@IndieDeveloperGuy Жыл бұрын
Thankyou so much , i was stuck on this question for a really long time.
@ameygadhe6437
@ameygadhe6437 Жыл бұрын
Damn girl you smart.
@ursawarior4ever
@ursawarior4ever 2 жыл бұрын
wow watched two other videos that made no sense and now i get it, THANK YOU
@mitrraaswin4933
@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
@pragneshamadavadi2267 Жыл бұрын
GEM 🔥🔥
@NaveenKumar-os8dv
@NaveenKumar-os8dv 2 жыл бұрын
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.
@probabilitycodingisfunis1
@probabilitycodingisfunis1 2 жыл бұрын
I appreciate that! Thanks
@chintanpatel9304
@chintanpatel9304 2 жыл бұрын
Nice explanation. Thanks for the solution
@prasantdas7182
@prasantdas7182 Жыл бұрын
Great explanation🔥
@soumakdalapati2026
@soumakdalapati2026 2 жыл бұрын
thanks for the video....great explanation !!!..🙏🙏
@sunilbhenspaliya9931
@sunilbhenspaliya9931 2 жыл бұрын
simple and best explained .thank you so much alisha
@probabilitycodingisfunis1
@probabilitycodingisfunis1 2 жыл бұрын
Glad it was helpful!
@mihirsagar2715
@mihirsagar2715 2 жыл бұрын
This is GOD level explanation
@pranshuadhwaryu6374
@pranshuadhwaryu6374 Жыл бұрын
Alisha dii keep going 💪🔥
@OMPRAKASH-fh3so
@OMPRAKASH-fh3so 2 жыл бұрын
Nice Explanation.
@gremlan6419
@gremlan6419 Жыл бұрын
Nice explanation
@kmanju6854
@kmanju6854 2 жыл бұрын
Perfect explanation
@asjadahmedkhan9661
@asjadahmedkhan9661 2 жыл бұрын
Just Amazing !!! The expiation is very very good!!. Keep up the good work.
@mahimahesh5094
@mahimahesh5094 7 ай бұрын
Thank you alisa
@priyankamishra5704
@priyankamishra5704 2 жыл бұрын
Well explained! finally understood the logic.
@rankitgujjar80
@rankitgujjar80 2 жыл бұрын
crystal clear explanation as always 🙇‍♂🙇‍♂
@mohitkumar557
@mohitkumar557 2 жыл бұрын
very easy logic to understand
@guptagaurav916
@guptagaurav916 2 жыл бұрын
The easiest to interpret. Thank you !
@ranitdey7369
@ranitdey7369 2 жыл бұрын
Really amazing explanation. Awesome ❤️!
@manup7636
@manup7636 3 жыл бұрын
Beauty with brains.
@digambardiwakar9535
@digambardiwakar9535 Жыл бұрын
thankyou so much
@vermadeepak84
@vermadeepak84 6 ай бұрын
what about finding all subarrays with unique elements? i.e., with no threshold
@tarunmali6228
@tarunmali6228 2 жыл бұрын
Great explanation!!!
@ShadabKhan-o2u
@ShadabKhan-o2u Жыл бұрын
Best
@atchaiyarajsaravanan
@atchaiyarajsaravanan Жыл бұрын
amazing video! please change the title to "subarrays with k distinct integers"
@Nitishkumar-rd4jq
@Nitishkumar-rd4jq 2 жыл бұрын
the answer i am waiting looking for!!!!!!!
@karthik4061
@karthik4061 2 жыл бұрын
Great work Keep going!!! :)
@AayushDubey_007
@AayushDubey_007 Жыл бұрын
In gfg , my Test Cases are stuck at 11024 /11027 or 11026/11027 (TLE) , what optimisation can be done?
@vamshisamineniz5905
@vamshisamineniz5905 2 жыл бұрын
good explanation
@probabilitycodingisfunis1
@probabilitycodingisfunis1 2 жыл бұрын
Thank you so much
@cricketsureshlucky
@cricketsureshlucky 9 ай бұрын
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
@arunmurukesh2830
@arunmurukesh2830 2 жыл бұрын
Good job ma...
@fpol890
@fpol890 2 жыл бұрын
Hello, do you offer tutoring by any chance?
@GoluYadav-cg3kx
@GoluYadav-cg3kx 2 жыл бұрын
isn't it expensive to use erase method for map, we can take an integer to keep track of unique elements
@franciskp9117
@franciskp9117 8 ай бұрын
Seeing all those tabs....my laptop just stopped working
@saktagan28
@saktagan28 2 жыл бұрын
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)
@mathematics6199
@mathematics6199 2 жыл бұрын
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-f7k
@CodingNinja-f7k 2 ай бұрын
what if the value of k=1
@RohitKumar-dy2gc
@RohitKumar-dy2gc Жыл бұрын
so easy i code by myself
@deeprealanalysis1407
@deeprealanalysis1407 Жыл бұрын
provide code as well
@vaibhavverma1340
@vaibhavverma1340 Жыл бұрын
please solve this using python !!
@nikunjgupta2878
@nikunjgupta2878 2 жыл бұрын
your code fail when value of k==1
@md.sahidulislam3152
@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;
@RishikeshPandaFeels
@RishikeshPandaFeels 2 жыл бұрын
Twitter?
@ShootOniPhone914
@ShootOniPhone914 2 жыл бұрын
perfect solution mam
@satyamjha-codeindwala6666
@satyamjha-codeindwala6666 Жыл бұрын
@ishansrivastava598
@ishansrivastava598 Жыл бұрын
hey i the way hello guys today in 2x
@rahuljain224
@rahuljain224 7 ай бұрын
Nice explanation
@md.hasanmahmud1390
@md.hasanmahmud1390 7 ай бұрын
good explanation
@satyamjha-codeindwala6666
@satyamjha-codeindwala6666 Жыл бұрын
Maximum Ones after Modification InterviewBit Code + Examples C++
17:53
Code with Alisha
Рет қаралды 11 М.
Players vs Pitch 🤯
00:26
LE FOOT EN VIDÉO
Рет қаралды 134 МЛН
Turn Off the Vacum And Sit Back and Laugh 🤣
00:34
SKITSFUL
Рет қаралды 3,5 МЛН
When u fight over the armrest
00:41
Adam W
Рет қаралды 31 МЛН
Use Magic Tool items😱
0:10
Kulsa on Internet
Рет қаралды 8 М.
Longest subarray with sum divisible by K | GfG problem of the day
16:48
Code with Alisha
Рет қаралды 11 М.
Subarrays with K Different Integers - Leetcode 992 - Python
17:31
Minimum Swaps to sort intuition + code C++ with explanation
15:25
Code with Alisha
Рет қаралды 23 М.
Leetcode 295. Find Median from Data Stream Intuition + Code C++ Example
27:59
11. Pointers in C++ | Guaranteed Placement Course
19:03
Apna College
Рет қаралды 673 М.
Leetcode 3. Longest Substring Without Repeating Characters
15:49
Code with Alisha
Рет қаралды 72 М.