Find element that appears once | Find missing number | Max Consecutive number of 1's | Arrays Part-3
HTML-код
- Опубликовано: 31 июл 2024
- Notes/C++/Java/Python codes in Step 3.1 of bit.ly/tufA2ZYt
Find the missing number: takeuforward.org/arrays/find-...
Maximum Consecutive Ones: takeuforward.org/data-structu...
Find the number that appears once, and the other numbers twice: takeuforward.org/arrays/find-...
Problem links.
Find the missing number: bit.ly/3ZdwAkN
Maximum Consecutive Ones: bit.ly/3ZFZji5
Find the number that appears once, and the other numbers twice: bit.ly/3VOlEHp
We have solved the above problems, and we have gone from brute force and ended with the most optimal solution.
Full Course: bit.ly/tufA2ZYt
You can follow me across social media, all my handles are below:
Linkedin/Instagram/Telegram: linktr.ee/takeUforward
0:00 Introduction of course
0:57 Missing Number
18:16 Code-compiler (Missing Number)
18:44 Maximum Consecutive number of 1's
21:06 Code-compiler (Maximum Consecutive number of 1's)
22:49 Find the number that appear once and other number twice
36:40 Code-compiler (Find the number that appear once and other number twice)
Let's march ahead, and create an unmatchable DSA course! ❤
Use the problem links in the description.
Find the number that appear once and other number twice : (Partially Accepted) needed binary search approach ?
bro u use map in array series and in course series so atleast give a short intro of whatever u r using the course bcz this course is for beginners as u said
@@Vijaykrishnan2000 binary search requires sorting and sorting takes O(nlogn)
so how it is more optimal ?
@@PHANTOMWORLD the given array is sorted. No need to sort it.
@@Vijaykrishnan2000 bro have you found soloution for this
In an interview, I personally feel jumping to "better" solution is good, instead of "brute" solution, if "better" exists that is.
Reasons:
- I dont think the time constraint allows for us to cycle through all three(brute, better, optimal) in 45min-1hr time window (usually 2-3 questions can be asked).
- Also brute are confusing at times, as it mostly involves combining many steps at times and the dry run will take time, so will the psuedo code.
- We must also account the stress of the interview, I don't think I can come up with different version of solutions for a single question without messing up the flow (which might ruin the concentration and cause panic). So I think its better to give a solution that you know it works for sure.
Agreed 💯
are you planning to put Scaler Academy out of business.?? 😆😆
Bhai matt has itna daant bahar nikal jayega
Bruhhh they take training from him lamo
Striver shouting top oof voice and these DSA problems are getting slightly one after the other in my head. Thanks Striver
I absolutely love your videos man! I understood everything very well. Internship season is gonna start very soon in my college and this helps me a ton!
0:00 Introduction of course
0:57 Missing Number
18:16 Code-compiler (Missing Number)
18:44 Maximum Consecutive number of 1's
21:06 Code-compiler (Maximum Consecutive number of 1's)
22:49 Find the number that appear once and other number twice
36:40 Code-compiler (Find the number that appear once and other number twice)
Please please please maintain consistency it's a humble request from the bottom of my heart 🙏🙏.
0:11 motivation 😅 required too
Understood everything, you are one of a kind Striver!
you're the best, man! hats off to you for great teaching and concepts that you elaborate so smoothly, i'm second year btech student and i am so thankful to have found you! ever since you came to my college for techtalk i've been motivated and a fan of yours, keep up the good work!
Thank you for all your videos! You have no idea how much these are helping everyone out there!!
Love your content striver keep blessing us with such amazing videos
Thank you Sir 🙏 Truly the way you explain is really easy to understand. It is hard to believe such a great man exist that gives such great quality material for free
You did a great job.... I used to afraid of dsa at first but the day I find your channel, I'll be more confident now to clear dsa rounds . Your hard work deserves a lot Striver. You explanation is crystal clear and it's keep us engaging with each step of concept.
we learn concept but forget again ,bcs there are lots of problems and concepts
Understood! Amazing explanation as always, thank you very much for your effort!!
bhaiya its mean a lot for us who can't afford a course...! and providing this level of lectures such a next level....! i will try to be a like you in future so i can help the peoples in other way....! thank you bhaiyya
you are real hero for me.
best teacher
like done 😊
Extraordinary way of teaching. I never thought I would be able to solve all these questions quickly. Thanks man
Corrected code for missing numbers:
class Solution {
public:
int missingNumber(vector& nums) {
for(int i = 1; i
The video and material were awesome. thanks for your efforts.
Understood! You make my day again brother!
Thankyou striver for your hardwork to make me understand your efforts make me work hard
Understood! Amazing Explanation!
Absolutly loved it, for the first problem in this video, I actually tried to solve it on my own, and thought of an solution which turns out to be a optimal solution you metioned here in this video, this is not a small achievement for me😃. Thank you striver.
Raj, Thanks a lot for This Amazing Video about C++ Arrays
Video - 3 Completed ✅
Understood each concept brother we need this kind of video 🎉
For the last problem Find number that appear once and other twice the below code passes all the 11 test cases
int getSingleElement(vector &arr){
int ans = 0;
for(int i=1;i
nice
that solution is wrong, it won't give correct output for cases like [0, 1, 0, 1, 2]
in this case at the first iteration for i=1:
arr[1-1] != arr[1] is true and thus it will return arr[1-1] as output, which is 0, whereas the correct output is clearly 2.
@@rudrsharma4758 It is sorted array though.
Thanks mate this does work
amazing just loved it
so clear explanation 😍
Understood!! Loved the lecture.
understood bhaiya...we need more videoes in a week, and get well soon..
Understood, Thank you so much for the awesome content..
Super amazing videos and explanations.
Thanks for the amazing content striver
Thanks for this amazing video..God bless you
His actions while explaining problems are just killer😎
Brilliantly Explained Bhaiya.
Hey Striver , i had a question since you're working in Europe.Do European tech companies also ask a lot of DSA in their interviews or is it more focused towards other topics like design ,LLD etc ? Would really love a video on this .
Lovely Work Raj.
You are my lifesaver thank you so much sir
Thank you bro. i got clear understanding. i understood it very well
Bhaiya kasam se din se so rkha tha🥲, abhi socha kya kru notification aagya thanks.
AWESOME EXPLANATION
As usual awesome ❤
Thanks for this amazing video
Hi Striver,
Thanks for your effort.When will you be covering strings and Heap.I am not able to see any video related to that topic in your channel.
understood bhaiyaaa thankyou for the great explaination
Great work ❤️
Loved the content
Understood striver much love to you
Very good explanation
As the input array is already sorted, we can use binary search to find the single element in the array.
public int singleNonDuplicate(int[] nums) {
int low = 0;
int high = nums.length - 1;
int mid;
while (low < high) {
mid = (low + high) / 2;
if (mid % 2 != 0) {
mid -= 1;
}
if (nums[mid] == nums[mid + 1]) {
low = mid + 2;
} else {
high = mid;
}
}
return nums[low];
}
Understood, thankyou bhaiya
great explanation sir
Understood, thanks striver.
Understood, Thank you
gaining confidence day by day one question though when should we revise?
any suggestions would be appreciated.
Thank you so much 😊
understood
and yes we need the video
understood !!! thank you
Understood everything Striver :)
Great stuff ❤❤
Understood sir❤🙇♂️🙏
god without temple❤❤❤
God who made RUclips a Temple ❤
Awesome Sir.............
understood thanks raj bhai
Hello sir
Thankyou for your efforts
I have a question sometimes I make the approach of a question but not able to code it...maybe lack of doing questions by myself
But just when I was doing questions of binary search of rotated sorted array of your DSA sheet...I am neither able to make approach nor code it....any guidance... (4th semester student)
Understood bhaiya ❤
one slight correction at 17:23 : xor can exceed largest number.(ie when number n%4==2)
sir you have my heart
😇
Bro can you please take some time out from your busy schedule and upload a detailed video on Java collection framework, and can you please let us know what all core skills required for being a Java developer apart from DSA.
Thanks
You can watch this detailed Java collections tutorial: ruclips.net/video/VE_AAUxTUCY/видео.html&ab_channel=RiddhiDutta
Love you sir understood
best explaination
Completed 3/28!!!
understood everything sir
Understood
More videos....🎉
UNDERSTOOD!
UNDERSTOOD!!
maza aa gaya .❤
understood, ty!!
understood sir 🙌
@takeUfoward I had one doubt, in missing number like what if the the last number is missing then the XOR logic will not work because it nums.size will itself be 1 less already so it will not work that case?
@26:50, why do you need a for loop to look for the largest element? the input array is already sorted so the last element will always be the largest no?
Thank you
Thank you Bhaiya
Bhaiyaa Thanks 😊👍
Understood sir!
thank you
understood bhaiyaa🙂
If a sorted array is given, then why do i need a for loop to find the max element? Cant i just initialize maxelement = arr[n-1]?
Thank you bhaiya SDE sheet ke questions karane ke liye
For the last problem's hashing approach why iterate through the given array to check their occurrence in hash array when you can just iterate through the hash array to check if hash[ i ] == 1 or not and then return i?
understood💯❤
hey can i use the same logic to code in JAVASCRIPT? since i am doing DSA in JAVASCRIPT.
thanks
1st optimal solution was really good and new for me 09:00
THANKS BRO
Understood✅🔥🔥
Thanks striver bro
UNDERSTOOOOODDDDDDDDD AWWWWHHHHH🥰
Understood😌.
what a teacher
UNDERSTOOD :))