Maximum Ones after Modification InterviewBit Code + Examples C++

  Рет қаралды 11,484

Code with Alisha

Code with Alisha

Күн бұрын

Пікірлер: 33
@ayushpathak2503
@ayushpathak2503 2 жыл бұрын
I don't why she is not that famous....her explanation is way better than every famous youtuber...
@utkarshasingh1836
@utkarshasingh1836 Жыл бұрын
couldn't stop myself from commenting, you explained it with such simplicity and clarity.
@11iqra
@11iqra Жыл бұрын
Best explanation of the problem on the internet!
@kirankumbhar2884
@kirankumbhar2884 2 жыл бұрын
Thanks for the solution! I solved this with a little bit different approach. 1. keep left and right at the start of the string 2. initialize ones_freq = 0 and result = 0 3. increment right by 1 and check if current character is 1, if yes increment ones_freq by 1 4. while right-left+1 - ones_freq > B (current window has more zeros than we can flip) 4.1 increment left by 1 (shrink window) if A[left] == 1 decrement ones_freq by 1 5. Here we have window satisfying the criteria so take max(result, right-left+ 1) This approach is basically keeping count of 1 in window and based on difference == allowed flips it is calculating the max size
@rankitgujjar80
@rankitgujjar80 2 жыл бұрын
Crystal clear explanation as always 🙇‍♂🙇‍♂
@feelit5386
@feelit5386 Жыл бұрын
truly amazing, aab nahi bhulunga yeh wala concept🥰
@AjayKushwaha-vi5vg
@AjayKushwaha-vi5vg Жыл бұрын
superb clear explanation.
@abhinandanraj535
@abhinandanraj535 3 жыл бұрын
just do it by using Sliding window concept int Solution::solve(vector &A, int B) { int count=B; int left=0; int right=0; int n= A.size(); int maxLen=0; while(right=0) { count--; } if(count>=0) { maxLen= max(maxLen,right-left+1); } while(count
@ravitalaugh9017
@ravitalaugh9017 8 ай бұрын
your explanation is really good
@ayushigupta685
@ayushigupta685 3 жыл бұрын
great explanation .. keep posting .I just love it
@anmolchauhan3822
@anmolchauhan3822 Жыл бұрын
Very Nice Explanation Mam😄😄
@manojkr7554
@manojkr7554 Жыл бұрын
Wow what a great explanation I love u dear ❤️💗🥰
@LearnWithAnmolll
@LearnWithAnmolll 4 ай бұрын
great explanation !!!!
@luckydewangan5985
@luckydewangan5985 Жыл бұрын
best explation I got for this question here thankyou so much for this content
@ankushladani496
@ankushladani496 Жыл бұрын
Explained so easily....
@AdityaYadav-kf4uc
@AdityaYadav-kf4uc Жыл бұрын
never commented on any youtube video but this explanation madee me to, thanks
@kunwarprashant1698
@kunwarprashant1698 3 жыл бұрын
Nice explanation
@lostcyrus8578
@lostcyrus8578 Жыл бұрын
Good explanation keep it up
@lostcyrus8578
@lostcyrus8578 Жыл бұрын
Please make more videos on popular questions.. you can refer to striver SDE sheet medium and hard ones
@SaTyamRaWaTvloGs
@SaTyamRaWaTvloGs Жыл бұрын
💯
@harishkulkarni7244
@harishkulkarni7244 3 жыл бұрын
Nice explanation, also in order to develop the intuition to solve problems is there any way? Or is this just practice, like solve n number of problems so that if n+1 problem is similar to any problem in those n just think similarly?
@saikrishna872
@saikrishna872 Жыл бұрын
Good Explanation What is Time and Space complexity
@dhruvsanghvi5562
@dhruvsanghvi5562 10 ай бұрын
mam could we also do it by recursion by thinking to either include one zero or not and then calculating maximum calculating for that choice
@darkexodus6404
@darkexodus6404 Жыл бұрын
After watching first 10mins of your video, this is how I tried to implemented it. My thought process was like to maintain a window. int findZeroes(int arr[], int n, int m) { vector zeros; for(int i=0; i
@notyet5009
@notyet5009 2 жыл бұрын
Special thanks to alisha's brother who is unable to sleep bcz of these lectures.
@abhishekanand9430
@abhishekanand9430 Жыл бұрын
complixity will be greater than n
@collegematerial5348
@collegematerial5348 2 жыл бұрын
Why you minus for calculate length
@rahulgheware5752
@rahulgheware5752 2 жыл бұрын
By using queue it is possible to store previous zero
@lankeshhj5725
@lankeshhj5725 Жыл бұрын
avoid extra space
@abhishekkarn8918
@abhishekkarn8918 2 жыл бұрын
whats the time complexity
@rankitgujjar80
@rankitgujjar80 2 жыл бұрын
it will be o(2n) at worst ig
@rishabhsingh-gw3gf
@rishabhsingh-gw3gf Жыл бұрын
woh bnda peeche so raha hai mooh par takiya laga kar🤣🤣
@nostalgiccringeallhailchel3881
@nostalgiccringeallhailchel3881 Жыл бұрын
weird explaination. Would have been much easier to understand if you just said you were gonna use sliding point approach
How Many Balloons To Make A Store Fly?
00:22
MrBeast
Рет қаралды 149 МЛН
ТВОИ РОДИТЕЛИ И ЧЕЛОВЕК ПАУК 😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 6 МЛН
When Cucumbers Meet PVC Pipe The Results Are Wild! 🤭
00:44
Crafty Buddy
Рет қаралды 60 МЛН
L4. Max Consecutive Ones III | 2 Pointers and Sliding Window Playlist
29:58
Longest subarray with sum divisible by K | GfG problem of the day
16:48
Code with Alisha
Рет қаралды 11 М.
15 Years Writing C++ - Advice for new programmers
4:04
SyncMain
Рет қаралды 1,3 МЛН
Leetcode 3. Longest Substring Without Repeating Characters
15:49
Code with Alisha
Рет қаралды 72 М.
Counting Subarrays #InterviewBit || Intuition + Code+ Example
13:24
Code with Alisha
Рет қаралды 10 М.
Max Consecutive Ones (LeetCode 1004) | Full Solution w/ animations
14:41
How Many Balloons To Make A Store Fly?
00:22
MrBeast
Рет қаралды 149 МЛН