Consistent Hashing | System Design
16:40
Пікірлер
@tejaswawadekar5699
@tejaswawadekar5699 7 күн бұрын
Bro we also got confused that why we are watching your explaination 6:30
@bharathraju5866
@bharathraju5866 7 күн бұрын
worst explanation
@iamnoob7593
@iamnoob7593 18 күн бұрын
u need to improve on ur explanation , Thank you.
@_compl3x_
@_compl3x_ 18 күн бұрын
What parts were unclear? I'm happy to clarify.
@tutkunazli2758
@tutkunazli2758 Ай бұрын
Thank you so much, this was the most helpful video I could find on this topic!
@ShahFaisalKhan987
@ShahFaisalKhan987 Ай бұрын
Nice
@Ankitkumar-hu8kp
@Ankitkumar-hu8kp 2 ай бұрын
class Solution { public: int characterReplacement(string s, int k) { int n=s.size(); int hashmap[256]; int maxf=0; int maxlen=0; int changes=0; for(int i=0;i<n;i++){ memset(hashmap,0,sizeof(hashmap)); int maxf=0; for(int j=i;j<n;j++){ hashmap[s[j]-'A']++; maxf=max(maxf,hashmap[s[j]-'A']); changes=(j-i+1)-maxf; if(changes<=k){ maxlen=max(maxlen,(j-i+1)); }else{ break; } } } return maxlen; } };
@NandanUpadhyay-w2f
@NandanUpadhyay-w2f 3 ай бұрын
good video
@ayushbalodhi7804
@ayushbalodhi7804 3 ай бұрын
gr8. the best explaination that i got
@Piyush-yp2po
@Piyush-yp2po 4 ай бұрын
good one
@nivedhav6139
@nivedhav6139 5 ай бұрын
I'm struck in this problem for a week. Thank you so much,well explained👍🏻
@ashutoshbajpai2393
@ashutoshbajpai2393 5 ай бұрын
good explanation, don't stop making video's, you are a good tutor
@studentvlog0312
@studentvlog0312 5 ай бұрын
what are u building bhiaya
@harshgoyal4050
@harshgoyal4050 6 ай бұрын
Bro I am learning DSA for 15 days consistently for 5 hours everyday. But I was only able to solve 2 Easy array problems on leetcode. Is it normal I am having a lot of self doubts. I have solved more than 30 problems of arrays but by watching strivers A2Z DSA sheet. I am not able to come up with solution on my own
@_compl3x_
@_compl3x_ 6 ай бұрын
It's been 2 years doing leetcode and i am still not able to solve many problems what i would recommend is resolve those problems on your own again. Don't judge yourself if you want to be a software developer not some DSA/CP Guy. It just one of the metric used in the industry to hire not the only metric. Also if you really want to be IT then get in habit of this feeling because things will not happen in one go , you will not be always knowing the stack before hand there are many uncontrollable variables. Keep Grinding!!
@harshgoyal4050
@harshgoyal4050 5 ай бұрын
Thanks alot bro for clearing my doubts. You are a life saver. I was really feeling that maybe I am not that smart. Can you suggest me what should I focus more on as a beginner.
@m67esteban
@m67esteban 6 ай бұрын
I tackle this problem, but I just sorted and reversed. Then count the maximum values. Didn't use monotonic stack tests passed in leetcode. Is monotonic stack really needed?
@_compl3x_
@_compl3x_ 6 ай бұрын
I can tell you why i used because we need to get the car that will be stopping other car from going forward so that we get the group of car.
@RajanKumar-vf7op
@RajanKumar-vf7op 7 ай бұрын
you should make more videos...btw clear and concise explanation.
@asmitsrivastava924
@asmitsrivastava924 8 ай бұрын
awesome explaination
@dhruvchopra26
@dhruvchopra26 8 ай бұрын
Great intuition of using 2D vector to save time complexity instead of priority_queue, every other solution was using priority queue. One small correction, both unordered_map and unordered_set have average O(1) time complexity for insert,erase,find etc. It is O(N) in the worst case for both ; which is very rare. So it doesn't matter if we use unordered_map<int,unordered_map> or unordered_map<int,unordered_set>.
@weirdoshah9957
@weirdoshah9957 8 ай бұрын
Many many thanks , finally got this problem with c++ ,
@MikasaAckerman-v8o
@MikasaAckerman-v8o 8 ай бұрын
great explanation
@priyankakataria7922
@priyankakataria7922 8 ай бұрын
What will be the time complexity here?
@sophia-sc4bh
@sophia-sc4bh 8 ай бұрын
Why have you stopped uploading videos? Or is there any other channel where you upload it?
@_compl3x_
@_compl3x_ 8 ай бұрын
I started it during my third year of college then I had time and space to do things now coming to Bangalore (internship) things are not great currently figuring out things It feels great that people like my videos there are haters also I am just an average engineering kid there are people way better than me I would you urge you to keep learning from them Money can't buy happiness but it can buy peace and time so keep grinding !!
@sophia-sc4bh
@sophia-sc4bh 8 ай бұрын
great explanation 👌👌
@akashchobari3893
@akashchobari3893 8 ай бұрын
Could u brief why using cnt+= end-start instead of cnt++?
@_compl3x_
@_compl3x_ 8 ай бұрын
Plz use pen and paper to count the number of subarrays from the whole array with at most sum equal to k (sum can be 0,1,2..k) then you will find out that doing cnt+=end-start is doing the same things of counting all the subarrays
@tng3100
@tng3100 9 ай бұрын
thank you , have been stuck on this sum for a long time, I was thinking with map. i understood now.
@sophia-sc4bh
@sophia-sc4bh 8 ай бұрын
we can do it using map too
@sophia-sc4bh
@sophia-sc4bh 8 ай бұрын
class Solution { public: int characterReplacement(string s, int k) { map<char,int> mp; int i=0,j=0; int ma=INT_MIN,maxi=INT_MIN; while(j<s.size()) { mp[s[j]]++; ma=max(ma,mp[s[j]]); if(j-i+1-ma>k) { mp[s[i]]--; ++i; } maxi=max(maxi,j-i+1); ++j; } return maxi; } };
@manisharyal4239
@manisharyal4239 9 ай бұрын
I dont understand why we're keeping the sum of end-start? What is the intution behind it?That is the length of the subarray but we are told to find the number of subarrays so doesn't make sense.
@_compl3x_
@_compl3x_ 8 ай бұрын
Plz use pen and paper to count the number of subarrays from the whole array with at most sum equal to k (sum can be 0,1,2..k) then you will find out that doing cnt+=end-start is doing the same things of counting all the subarrays
@abhishekanand9430
@abhishekanand9430 9 ай бұрын
thank you bro
@_compl3x_
@_compl3x_ 9 ай бұрын
Thanks for the support plz consider subscribing to the channel if you haven't Keep Grinding!!
@Amisha-k9n
@Amisha-k9n 9 ай бұрын
Grt explaination
@_compl3x_
@_compl3x_ 9 ай бұрын
Thanks for the support plz consider subscribing to the channel if you haven't Keep Grinding!!
@saqibmasood501
@saqibmasood501 10 ай бұрын
underrated KZbinr
@priyanshudawar7404
@priyanshudawar7404 10 ай бұрын
good explanation bro
@_compl3x_
@_compl3x_ 10 ай бұрын
Thanks means alot ... Please consider subscribing to the channel if you haven't. Keep Grinding!!
@shreshthavbisht3940
@shreshthavbisht3940 10 ай бұрын
sorry to say but please Improve your english its hard to understand in between
@_compl3x_
@_compl3x_ 10 ай бұрын
Thanks for the comment that's what i am trying to do. At least I am not faking it and have the guts to accept it openly and work on it
@shubhamkumar-hx1fb
@shubhamkumar-hx1fb 10 ай бұрын
why u didnt change the maxfreq after shrinking the window
@_compl3x_
@_compl3x_ 10 ай бұрын
In line 16 of the code I am doing that After decreasing the window size and checking what is the current max after the shrink
@missionmaths3867
@missionmaths3867 10 ай бұрын
gadha prana ata nhi hai bhai tu apni video dekh pehle tujhe smjh aa rha h
@_compl3x_
@_compl3x_ 10 ай бұрын
Thanks for the motivation and watch time
@raihanmomtaz7652
@raihanmomtaz7652 11 ай бұрын
Awesome 🤘
@saurabh7650
@saurabh7650 11 ай бұрын
nicely explained.
@CodingJoySoul
@CodingJoySoul Жыл бұрын
Why aren't you uploading videos anymore?
@_compl3x_
@_compl3x_ 10 ай бұрын
I will start uploading again soon !!
@shriramravichandran2956
@shriramravichandran2956 10 ай бұрын
@@_compl3x_ Pls upload more dp and monotonic stack,queues type of problems. Thanks. Your videos were super helpful
@OG_RAJAT
@OG_RAJAT Жыл бұрын
searching for sol for 2 hoours now i found this gem video thank you
@sumitsinha995
@sumitsinha995 Жыл бұрын
explained well brother but put title using MaxHeap
@bhuppidhamii
@bhuppidhamii Жыл бұрын
your writing<3
@akashmangal6042
@akashmangal6042 Жыл бұрын
Valuable 🙇
@ABHISHEKTIWARI-qw2gb
@ABHISHEKTIWARI-qw2gb Жыл бұрын
Another awesome explaination !! 🎉
@prashanttrivedi6957
@prashanttrivedi6957 Жыл бұрын
Well explained
@singhji4149
@singhji4149 Жыл бұрын
Explanation is not that much clear at 5:22 and 5:24
@_compl3x_
@_compl3x_ Жыл бұрын
What I am trying to say is to reach (2,2) 4 with help +5 we can reach it But not meaning that we will use all +1 only required to increase the freq of that number over there it was 2
@shivanigupta_19
@shivanigupta_19 Жыл бұрын
Why we are doing this -> getNumSubarraysWithSum(nums, goal) - getNumSubarraysWithSum(nums, goal - 1);
@_compl3x_
@_compl3x_ Жыл бұрын
For ex atmost 2 means 0,1,2 and atmost 1 means 0,1 and if you remove 0,1 case from atmost 2 You will get exactly 2
@shivanigupta_19
@shivanigupta_19 Жыл бұрын
@@_compl3x_ Thankyou
@_compl3x_
@_compl3x_ Жыл бұрын
Please consider subscribing to the channel if you haven't …. Keep Grinding
@chandrachurmukherjeejucse5816
@chandrachurmukherjeejucse5816 Жыл бұрын
Great!!!!
@engg.5111
@engg.5111 Жыл бұрын
how you know that to find exact k =atmost(k) - atmost(k-1) ??
@_compl3x_
@_compl3x_ Жыл бұрын
For ex atmost 2 means 0,1,2 and atmost 1 means 0,1 and if you remove 0,1 case from atmost 2 You will get exactly 2
@pavankiran4088
@pavankiran4088 Жыл бұрын
👍🏻
@jatin_goyal
@jatin_goyal Жыл бұрын
Rather teach in hindi if you are not taht fluent in english . Speak more and tell intuition more deeply only then its useful to watch videos which peeps come for. Take it as feedback.. no grudges
@_compl3x_
@_compl3x_ Жыл бұрын
Thanks for your feedback 1. There is no better way to grow as a person than to do everyday something you hate.” ~ David Goggins 2. Never made these with the intent that people will watch my videos it is just to improve my communication skill 3. And if you want to give judgment watch my latest videos, whether I have to switch to Hindi or not 4. Every pro was once a beginner 5. Showing the real process of how normal people start and get going unlike others that portray picture-perfect scenarios
@swatilohiya6113
@swatilohiya6113 Жыл бұрын
I'ts time complexity should be O(nlog(n))??
@asthajain2511
@asthajain2511 Жыл бұрын
Awesome Expalnation >>>>>>>>>>>>>>>>>
@_compl3x_
@_compl3x_ Жыл бұрын
Glad you liked it...Please consider subscribing to the channel if you haven't...keep grinding
@aviralpruthi4240
@aviralpruthi4240 Жыл бұрын
You are checking only top element,while inserting new pair and break the loop if sum greater than topmost element sum But still that new sum can be less than some other elements sum present in heap
@_compl3x_
@_compl3x_ Жыл бұрын
We are using max heap and top is greatest if something is not smaller than the greatest among k then how it can be smaller than the rest Plz use pen and paper to dry run
@aviralpruthi4240
@aviralpruthi4240 Жыл бұрын
@@_compl3x_ your approach 2 code is not working on leetcode