Find element that appears once | Find missing number | Max Consecutive number of 1's | Arrays Part-3

  Рет қаралды 310,982

take U forward

take U forward

Күн бұрын

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)

Пікірлер: 505
@takeUforward
@takeUforward Жыл бұрын
Let's march ahead, and create an unmatchable DSA course! ❤ Use the problem links in the description.
@Vijaykrishnan2000
@Vijaykrishnan2000 Жыл бұрын
Find the number that appear once and other number twice : (Partially Accepted) needed binary search approach ?
@ayushsaurav38
@ayushsaurav38 Жыл бұрын
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
@PHANTOMWORLD
@PHANTOMWORLD Жыл бұрын
@@Vijaykrishnan2000 binary search requires sorting and sorting takes O(nlogn) so how it is more optimal ?
@subrajeetmaharana
@subrajeetmaharana Жыл бұрын
@@PHANTOMWORLD the given array is sorted. No need to sort it.
@itsmrcrazy7670
@itsmrcrazy7670 Жыл бұрын
@@Vijaykrishnan2000 bro have you found soloution for this
@ariobotgaming
@ariobotgaming Ай бұрын
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.
@Josuke217
@Josuke217 22 күн бұрын
Agreed 💯
@karthik-varma-1579
@karthik-varma-1579 16 сағат бұрын
The Striver Approach is good for learning process and it will be helpful to think for good solution... but in interview's they expect us to solve the problem(in less time constraint ) so we explain the Better Approach and we Optmize it to Optimal Approach to interviewer and directly jump into the optimal code. so this is good pathway we should follow in the interview. SO ask the interviewer for time given to solve this solution . Mostly Try to jump into the direct optimal solution.
@sharathkumar8338
@sharathkumar8338 Жыл бұрын
are you planning to put Scaler Academy out of business.?? 😆😆
@shubhamKumar-mb6he
@shubhamKumar-mb6he 3 ай бұрын
Bhai matt has itna daant bahar nikal jayega
@abhishekg2766
@abhishekg2766 Ай бұрын
Bruhhh they take training from him lamo
@Akash-yr2if
@Akash-yr2if Жыл бұрын
Striver shouting top oof voice and these DSA problems are getting slightly one after the other in my head. Thanks Striver
@actuallynxiss
@actuallynxiss Жыл бұрын
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!
@reki7247
@reki7247 Жыл бұрын
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!
@ParasSharma-mf8or
@ParasSharma-mf8or Жыл бұрын
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 🙏🙏.
@alwayshemanthreddy
@alwayshemanthreddy 5 ай бұрын
0:11 motivation 😅 required too
@merlingrace6850
@merlingrace6850 9 ай бұрын
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.
@user-oi1oe5he5r
@user-oi1oe5he5r 5 ай бұрын
we learn concept but forget again ,bcs there are lots of problems and concepts
@helloworld2054
@helloworld2054 Жыл бұрын
Understood everything, you are one of a kind Striver!
@Deena_Bandhu
@Deena_Bandhu Жыл бұрын
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
@shubhamagarwal1434
@shubhamagarwal1434 14 сағат бұрын
#Free Education For All.. # Bhishma Pitamah of DSA...You could have earned in lacs by putting it as paid couses on udamey or any other elaerning portals, but you decided to make it free...it requires a greate sacrifice and a feeling of giving back to community, there might be very few peope in world who does this...."विद्या का दान ही सर्वोत्तम दान होता है" Hats Off to you man, Salute from 10+ yrs exp guy from BLR, India....
@AarzooBansal
@AarzooBansal Ай бұрын
Thank you for all your videos! You have no idea how much these are helping everyone out there!!
@gwatsinthong3180
@gwatsinthong3180 5 ай бұрын
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
@rahulkathayat8542
@rahulkathayat8542 Жыл бұрын
Love your content striver keep blessing us with such amazing videos
@cinime
@cinime Жыл бұрын
Understood! Amazing explanation as always, thank you very much for your effort!!
@GB-su9gu
@GB-su9gu Жыл бұрын
you are real hero for me. best teacher like done 😊
@pranavrakhunde
@pranavrakhunde 11 ай бұрын
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
@user-oi1oe5he5r
@user-oi1oe5he5r 5 ай бұрын
nice
@rudrsharma4758
@rudrsharma4758 2 ай бұрын
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.
@user-kk2pk2cd9c
@user-kk2pk2cd9c 2 ай бұрын
@@rudrsharma4758 It is sorted array though.
@akshitrajputhere
@akshitrajputhere Ай бұрын
Thanks mate this does work
@Josuke217
@Josuke217 25 күн бұрын
Extraordinary way of teaching. I never thought I would be able to solve all these questions quickly. Thanks man
@tabrezahmed1000
@tabrezahmed1000 11 ай бұрын
Corrected code for missing numbers: class Solution { public: int missingNumber(vector& nums) { for(int i = 1; i
@PrithaMajumder
@PrithaMajumder 2 ай бұрын
Raj, Thanks a lot for This Amazing Video about C++ Arrays Video - 3 Completed ✅
@055_meetmakwana9
@055_meetmakwana9 5 ай бұрын
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.
@john_doe_2231
@john_doe_2231 Жыл бұрын
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 .
@jishnuraj2278
@jishnuraj2278 Жыл бұрын
Understood! Amazing Explanation!
@aashishas7044
@aashishas7044 11 ай бұрын
The video and material were awesome. thanks for your efforts.
@Viratrohit184
@Viratrohit184 Жыл бұрын
Thankyou striver for your hardwork to make me understand your efforts make me work hard
@itzmartin20
@itzmartin20 11 ай бұрын
Understood! You make my day again brother!
@himadriroy7980
@himadriroy7980 9 ай бұрын
Understood!! Loved the lecture.
@dhruvsolanki4473
@dhruvsolanki4473 Жыл бұрын
Super amazing videos and explanations.
@virendrakumarmishra876
@virendrakumarmishra876 Жыл бұрын
amazing just loved it so clear explanation 😍
@AJDJ108
@AJDJ108 9 ай бұрын
Understood each concept brother we need this kind of video 🎉
@varunvarun5723
@varunvarun5723 Жыл бұрын
Thanks for the amazing content striver
@Ishantkumar-cr6ug
@Ishantkumar-cr6ug Жыл бұрын
understood bhaiya...we need more videoes in a week, and get well soon..
@saikrishnaganguri
@saikrishnaganguri Жыл бұрын
Understood, Thank you so much for the awesome content..
@habeeblaimusa4466
@habeeblaimusa4466 Жыл бұрын
Thanks for this amazing video..God bless you
@utsavseth6573
@utsavseth6573 Жыл бұрын
Lovely Work Raj.
@SudhanshuPanthri
@SudhanshuPanthri Жыл бұрын
Brilliantly Explained Bhaiya.
@ABCDEFGH-fz5ju
@ABCDEFGH-fz5ju 3 ай бұрын
His actions while explaining problems are just killer😎
@kavyabanka4482
@kavyabanka4482 Жыл бұрын
Thanks for this amazing video
@sukhpreetsingh5200
@sukhpreetsingh5200 Жыл бұрын
As usual awesome ❤
@user-fn1lx2gv9j
@user-fn1lx2gv9j Жыл бұрын
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]; }
@konankikeerthi
@konankikeerthi 2 ай бұрын
Thank you bro. i got clear understanding. i understood it very well
@vishal_s583
@vishal_s583 Жыл бұрын
Great work ❤️
@shanmugapriya6735
@shanmugapriya6735 Жыл бұрын
You are my lifesaver thank you so much sir
@praveentiwari629
@praveentiwari629 10 ай бұрын
AWESOME EXPLANATION
@suheabkhan2546
@suheabkhan2546 Жыл бұрын
Loved the content
@bitlegion1027
@bitlegion1027 10 ай бұрын
understood bhaiyaaa thankyou for the great explaination
@aliakbaransaria3-925
@aliakbaransaria3-925 11 ай бұрын
Very good explanation
@shivangisirohi6032
@shivangisirohi6032 7 ай бұрын
great explanation sir
@monimoni6760
@monimoni6760 Жыл бұрын
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.
@rohitprasad5708
@rohitprasad5708 Жыл бұрын
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
@aadeshputhran7642
@aadeshputhran7642 Жыл бұрын
You can watch this detailed Java collections tutorial: kzbin.info/www/bejne/jHbCcnSLrbmIebs&ab_channel=RiddhiDutta
@DeveloperRB
@DeveloperRB 9 ай бұрын
Great stuff ❤❤
@gouravupadhyay9092
@gouravupadhyay9092 10 ай бұрын
Understood, thankyou bhaiya
@shorts_shots514
@shorts_shots514 Жыл бұрын
understood !!! thank you
@hareshnayak7302
@hareshnayak7302 4 ай бұрын
Understood, thanks striver.
@Mythri333
@Mythri333 5 ай бұрын
Thank you so much 😊
@Ramsiya658
@Ramsiya658 Жыл бұрын
Understood striver much love to you
@rish7394
@rish7394 Жыл бұрын
Bhaiya kasam se din se so rkha tha🥲, abhi socha kya kru notification aagya thanks.
@DevashishJose
@DevashishJose Жыл бұрын
Understood, Thank you
@sarangkumarsingh7901
@sarangkumarsingh7901 4 ай бұрын
Awesome Sir.............
@shreyanshsharma7906
@shreyanshsharma7906 Жыл бұрын
understood thanks raj bhai
@sohamchikane6591
@sohamchikane6591 11 ай бұрын
gaining confidence day by day one question though when should we revise? any suggestions would be appreciated.
@peddikarthik7832
@peddikarthik7832 Жыл бұрын
one slight correction at 17:23 : xor can exceed largest number.(ie when number n%4==2)
@_hulk748
@_hulk748 Жыл бұрын
Understood sir❤🙇‍♂️🙏
@Hipfire786
@Hipfire786 3 ай бұрын
understood everything sir
@fallenAngel-cw9ki
@fallenAngel-cw9ki Жыл бұрын
understood, ty!!
@khushil9988
@khushil9988 8 ай бұрын
understood and yes we need the video
@themusicguy539
@themusicguy539 Жыл бұрын
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)
@winter_hope_
@winter_hope_ 4 күн бұрын
Love you sir understood
@Raj10185
@Raj10185 Жыл бұрын
Understood everything Striver :)
@faysalmahmud2721
@faysalmahmud2721 Жыл бұрын
best explaination
@foreverabel7680
@foreverabel7680 11 ай бұрын
understood sir 🙌
@prachyotbalijapelly1881
@prachyotbalijapelly1881 4 ай бұрын
god without temple❤❤❤
@swagcoder
@swagcoder Ай бұрын
God who made KZbin a Temple ❤
@divyaagarwal3563
@divyaagarwal3563 Жыл бұрын
UNDERSTOOD!
@ajaywankhade5054
@ajaywankhade5054 3 ай бұрын
Thank you
@Miracle_shaw
@Miracle_shaw Жыл бұрын
thank you
@sahilranjan324
@sahilranjan324 Жыл бұрын
Bhaiyaa Thanks 😊👍
@yashwanthbm7543
@yashwanthbm7543 Жыл бұрын
THANKS BRO
@ankushladani496
@ankushladani496 Жыл бұрын
Understood More videos....🎉
@AsharMallick750
@AsharMallick750 Жыл бұрын
Thanks striver bro
@indroneelgoswami5654
@indroneelgoswami5654 9 күн бұрын
UNDERSTOOD!!
@user-gl8mv6dg4t
@user-gl8mv6dg4t 20 күн бұрын
maza aa gaya .❤
@AniketSingh-gm9nh
@AniketSingh-gm9nh 11 күн бұрын
understood bhaiyaa🙂
@lifehustlers164
@lifehustlers164 10 ай бұрын
Completed 3/28!!!
@user-tk2vg5jt3l
@user-tk2vg5jt3l 6 ай бұрын
Thank you Bhaiya
@Sanjana-gp3gn
@Sanjana-gp3gn Жыл бұрын
Understood bhaiya ❤
@mehrasmotivation6970
@mehrasmotivation6970 Жыл бұрын
Thank you bhaiya SDE sheet ke questions karane ke liye
@RaviKumar-sn6tu
@RaviKumar-sn6tu 5 ай бұрын
sir you have my heart 😇
@karnifex7606
@karnifex7606 Жыл бұрын
missing number with one variable(more simplified) int res = N; for(int i=0; i
@ROCKY-tq1we
@ROCKY-tq1we 6 ай бұрын
For the missing number problem we can use index to compare the elements: for ( int i = 0 ; i < n ; i++) { if ( arr[i] ! = i+1 ) { return i; } }
@dbhanuprakash515
@dbhanuprakash515 6 ай бұрын
This will not applicable if array is not in sorted order ❤
@chennupalliharish7126
@chennupalliharish7126 4 ай бұрын
just use sum of n natural numbers formula and take all the sum into a varaible .Subtract each element from sum with all the array element and return the end sum
@prafulsharma462
@prafulsharma462 3 ай бұрын
I don't get why he is iterating 1st for loop in missing number From 0 to =n it will give an exception If some one know pls tell One more thing In 2nd loop why 0 to n-1
@aakash_jamadar939
@aakash_jamadar939 3 ай бұрын
It won't work. take A=[1,1,2,2,3] and check
@aakash_jamadar939
@aakash_jamadar939 3 ай бұрын
@@prafulsharma462 we don't do arr[i] for first loop,we use only numbers(i) in this loop.so we used range of numbers present in the array(i,e 1 to n). for 2nd loop,we need arr[j],so we use 0 to
@heyOrca2711
@heyOrca2711 4 ай бұрын
Understood sir!
@NIRI0242
@NIRI0242 12 күн бұрын
If you ever feel so broken dont ever forget you re golden, i will find the light in you.❤❤❤
@s_sattu_s
@s_sattu_s 4 ай бұрын
Here's my most optimal code for the last question using XOR : class Solution { public: int singleNumber(vector& nums) { int ans = 0; for(int i=0; i
@khalasianiket816
@khalasianiket816 Ай бұрын
understood ❤
@vipinpathak8373
@vipinpathak8373 Жыл бұрын
understood!!
@harishthoie5861
@harishthoie5861 Ай бұрын
understood brother
@rijudey8008
@rijudey8008 Жыл бұрын
understood❤
@jashanuppal9678
@jashanuppal9678 5 ай бұрын
@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?
@per.seus._
@per.seus._ Жыл бұрын
understood💯❤
@YourCodeVerse
@YourCodeVerse 10 ай бұрын
Understood✅🔥🔥
@aadeshputhran7642
@aadeshputhran7642 Жыл бұрын
For the number that appears once problem, if the input array is sorted, I think the optimal time complexity will be O(log n) using binary search.
@takeUforward
@takeUforward Жыл бұрын
Yes if it is sorted, here it was not
@user-ll9py8pq2u
@user-ll9py8pq2u 7 ай бұрын
how can i solve this question using binary search
@jaydeeppatil7936
@jaydeeppatil7936 7 ай бұрын
@@user-ll9py8pq2u did you manage to solve it using binary search
How I would learn Leetcode if I could start over
18:03
NeetCodeIO
Рет қаралды 396 М.
路飞太过分了,自己游泳。#海贼王#路飞
00:28
路飞与唐舞桐
Рет қаралды 37 МЛН
Finger Heart - Fancy Refill (Inside Out Animation)
00:30
FASH
Рет қаралды 29 МЛН
Slow motion boy #shorts by Tsuriki Show
00:14
Tsuriki Show
Рет қаралды 10 МЛН
Binary Search Algorithm - Computerphile
18:34
Computerphile
Рет қаралды 158 М.
Why Sentinels Got Worse but GEN.G Got Better
12:07
Platoon
Рет қаралды 72 М.
I Made An Extreme Demon, But Using Mario Gimmicks!
25:00
XcreatorGoal
Рет қаралды 36 М.
Google Coding Interview With A High School Student
57:24
Clément Mihailescu
Рет қаралды 4,1 МЛН
❌ Don't Run Behind 500 LEETCODE Problems ❌ Focus on QPCD
8:31
The Mysterious Double Jump Bug...
3:13
Daily Dose of Geometry Dash
Рет қаралды 50 М.
路飞太过分了,自己游泳。#海贼王#路飞
00:28
路飞与唐舞桐
Рет қаралды 37 МЛН