First Missing Positive || Intuition + Example + Explanation || Must Do for Amazon

  Рет қаралды 30,921

Code with Alisha

Code with Alisha

Күн бұрын

Пікірлер: 107
@divyadwivedi1527
@divyadwivedi1527 Жыл бұрын
The BEST Explanation on UTube , got a new approach to learn,Thanks a lot
@Itachi16-U
@Itachi16-U 10 ай бұрын
I went through 2 to 3 videos in youtube. No one explained better than you. Thanks for the better explanation.
@learnwithayush7838
@learnwithayush7838 Жыл бұрын
I must say this is very underrated coding channel . You must Do an Q/A 😀
@bhandarkarsomesh8277
@bhandarkarsomesh8277 2 жыл бұрын
such a great explanation, never going to forget the chair example !!
@adityarangra9019
@adityarangra9019 Жыл бұрын
aap sach mein kaafi acha explain krte ho meine 4-5 videos dekhi so that ki koi small length ki video mein explain krde.... but at the end merko yahi par aa kr ke samjh aaya pura concept ....................... your explaination is so easy to understand..... hard question bhi easily samjh aa gya
@kotlaarunkumar4251
@kotlaarunkumar4251 Ай бұрын
Simple n easy explanation... thanks Alisha
@piyushsingh9320
@piyushsingh9320 2 жыл бұрын
Not all superheriones wear capes, some of them make videos to help others..
@probabilitycodingisfunis1
@probabilitycodingisfunis1 2 жыл бұрын
Thank you so much Piyush!!
@andiamakaza24
@andiamakaza24 2 жыл бұрын
yeh aach tha
@kuntellashanker2497
@kuntellashanker2497 Ай бұрын
Good explanation your way of thinking is so good
@gkushwanth2277
@gkushwanth2277 10 ай бұрын
superb explanation. I saw many videos for the approach of this question,among all your explanation I easily understood.
@mohit7717
@mohit7717 11 ай бұрын
I like the Mother and childs example.... Nice explanation
@jethala138
@jethala138 2 жыл бұрын
Sweety ran away with Guddu Bhayia, that's why she was not able to sit on her chair :) Btw great explanation thanks.
@probabilitycodingisfunis1
@probabilitycodingisfunis1 2 жыл бұрын
Haha lol :)
@pranjalmodanwal7842
@pranjalmodanwal7842 10 ай бұрын
best expanation on youtube. Thanks a lot!!!
@dhruvsanghvi5562
@dhruvsanghvi5562 Жыл бұрын
Your explaination is really great and creative, liked a lot
@CS090Srikanth
@CS090Srikanth 3 ай бұрын
Best and easiest explanation ❤
@AmanTheMystery
@AmanTheMystery 2 жыл бұрын
thanks mam great explanation, keep doing good work it helps all
@darshan5945
@darshan5945 5 ай бұрын
Great Explanation with the analogy.. it really helps to understand.. But just want to point out that time complexity of this solution is not O(n).. But practically this runs faster.
@deep14054
@deep14054 Жыл бұрын
Hi ma'am thanks for the solution, I came up with this solution: int firstMissingPositive(vector& nums) { int ans = 1; sort(nums.begin(), nums.end()); for(auto i: nums) if(i == ans) ans++; return ans; }
@isdardedilkisifarish3366
@isdardedilkisifarish3366 Жыл бұрын
nlogn hai ye solution
@karthikp6473
@karthikp6473 Жыл бұрын
By far the easiest approach ever
@himanshulal8345
@himanshulal8345 Жыл бұрын
Nice explanation for a tricky problem... thank you..
@kameshwarmehta8435
@kameshwarmehta8435 Жыл бұрын
u have explain different approach for these question,thanku mam🙌.but u have missed one edge condition for swapping,that ele >0 && ele
@akhilkhandelwal3927
@akhilkhandelwal3927 Жыл бұрын
Great Explanation di 😄. Completely Understood.
@sajalsrivastava4655
@sajalsrivastava4655 Жыл бұрын
luv u ......ek no explanation
@Pr3kashSingh
@Pr3kashSingh 2 ай бұрын
nice explanation . finally got it .thanks
@Rajesh-sr9us
@Rajesh-sr9us 2 жыл бұрын
After seeing this i think you are underrated
@AmanTheMystery
@AmanTheMystery 2 жыл бұрын
no she is not under rated
@abhaydeepsharma5027
@abhaydeepsharma5027 Жыл бұрын
If anyone suffers that it is showing error , try to add condition for out of bound indexes for(int i=0;i0 && arr[i]0 && arr[i]
@harshavardhanpatekar5697
@harshavardhanpatekar5697 11 ай бұрын
Great explaination!!
@muditkhanna8164
@muditkhanna8164 Жыл бұрын
technically the TC will be > than 0(n), athough great solution.
@venkateswaraswamyallumolu191
@venkateswaraswamyallumolu191 11 ай бұрын
What is the difference between keeping the line “int chair = element -1 “ inside the condition and outside the condition
@ugempireninjaaaaaahatori6755
@ugempireninjaaaaaahatori6755 10 ай бұрын
amazing solution , you just made mom play...
@sukiratsingh985
@sukiratsingh985 Жыл бұрын
How can you say that missing no is in range [ 1,n] because in this case [7,8,9,10,11,12] all the elements are >n=6
@SajanKumar-ec2us
@SajanKumar-ec2us 4 ай бұрын
good explanation
@sansai9329
@sansai9329 2 жыл бұрын
what if the first missing element range is from 0 - n? Taking chair = element instead of element -1 should work right?
@tauffiqshaikh7419
@tauffiqshaikh7419 2 жыл бұрын
Yes, it does. Also, you must take care of element's range
@roshansadhasanker3525
@roshansadhasanker3525 2 жыл бұрын
why did you asssing chair value after if ?? why not before ?
@aviralarpan7350
@aviralarpan7350 2 жыл бұрын
Lol
@satyams8974
@satyams8974 Жыл бұрын
Because if chair value >=nums.siz() , then in the if condition we will check for nums[char] which is invalid index. So with if condition we only give those values to chair which are lesser than size
@spritual_things05
@spritual_things05 6 ай бұрын
Thank you so much sister
@davidmwangi4312
@davidmwangi4312 2 жыл бұрын
Great Explanation,
@JorawarSingh-n4s
@JorawarSingh-n4s 22 күн бұрын
Thanks ma'am
@sahilverma03
@sahilverma03 Жыл бұрын
i think in the same way we do sorting in constant space, if numbers are positive
@anvy_9924
@anvy_9924 9 ай бұрын
Hi, you explained pretty well, but the code is failing for this unit case. Input nums = [3, 4, 1, 1]. output = 1 expected = 2
@shadabahmadkhan4986
@shadabahmadkhan4986 Жыл бұрын
Thank you ! very well explained
@cringeworld8708
@cringeworld8708 2 жыл бұрын
Osm solution🤜
@karandeepsingh6201
@karandeepsingh6201 2 жыл бұрын
Wonderful explanation
@trinitykhuman
@trinitykhuman Жыл бұрын
Great explanation. Thanks
@BACSShaileshShettar
@BACSShaileshShettar Жыл бұрын
great explanation!
@ShubhamKumarSingh6224
@ShubhamKumarSingh6224 Жыл бұрын
i thought girls are not good in coding but you proove me wrong and i'm happy to see my self being wrong
@lavanyakataria101
@lavanyakataria101 2 жыл бұрын
Grt example di, never going to forget
@lavanyakataria101
@lavanyakataria101 2 жыл бұрын
& Dii you are beautiful ☺
@musharrafhussain130
@musharrafhussain130 Жыл бұрын
@@lavanyakataria101 us
@VinothiniAnabayan
@VinothiniAnabayan 3 ай бұрын
im searching for strivers video, oh it is not present, im looking for code with alisha's video then, doing great job
@ipranavprashant
@ipranavprashant Жыл бұрын
Ahh gotcha, the similar approach you used to count the minimum no of swaps to sort the array..thnx
@aaravanand2325
@aaravanand2325 12 күн бұрын
Thankyou Alisha!
@aizad786iqbal
@aizad786iqbal 10 ай бұрын
also , one suggestion, please add code links..
@ASR-mz3cc
@ASR-mz3cc Жыл бұрын
mam plz can u make videos on trees data structure, after three months we have placement interviews in college .in fact good explanation with understanding examples :)
@nikhilsatyam4815
@nikhilsatyam4815 2 жыл бұрын
again you explained it very well. di i have a question, i solved the question but i forget the solution after some days waht to do in this conditions.
@vyankateshzawar7999
@vyankateshzawar7999 Жыл бұрын
best ❤
@sahirmuzaffar883
@sahirmuzaffar883 2 жыл бұрын
best explanation
@shvmsh20
@shvmsh20 2 жыл бұрын
This story is the usp for the solution
@vakhariyajay315
@vakhariyajay315 Жыл бұрын
Thank you very much.
@Ronifromearth
@Ronifromearth 2 жыл бұрын
great work sis
@vinamrasangal8436
@vinamrasangal8436 Ай бұрын
thanks a lot alisha didi ~@@~
@aakashgupta7211
@aakashgupta7211 2 жыл бұрын
Very secular mother😄 @5:00
@probabilitycodingisfunis1
@probabilitycodingisfunis1 2 жыл бұрын
Lol , had to mix up mine, brother's and few random names :)
@lakshay6043
@lakshay6043 2 жыл бұрын
i did this question before but forgot the logic. hope the story helps.
@AyushSingh-nu3gt
@AyushSingh-nu3gt Жыл бұрын
too good !
@GauravKumar-py5br
@GauravKumar-py5br 2 жыл бұрын
ma'am first test missing number should be 0 not 6
@ashwinirathi238
@ashwinirathi238 Жыл бұрын
this approach is not optimal to handle this case [3,4,-1,1] to make this we need to tweak your code like this i think this sol is not optimal, i did some modification you can check n = len(nums) j=n while j: right_palace =True for i in range(n): element=nums[i] if element>=1 and element
@lonen3rd
@lonen3rd Жыл бұрын
Works, but is the time complexity still O(n)?
@AmanTheMystery
@AmanTheMystery Жыл бұрын
Thanks alisha
@sn8974
@sn8974 Жыл бұрын
Haaa bhosdiwala kitini bar message karega😂🤣
@341yes
@341yes Жыл бұрын
Thanku!❤
@Idukhan-jj9kc
@Idukhan-jj9kc 3 жыл бұрын
Perfect
@rabindrapatra7151
@rabindrapatra7151 6 ай бұрын
Alisha has a brother named as Arman
@abhijeetrishi6472
@abhijeetrishi6472 2 жыл бұрын
i think this code will fail for array with repeating elements like [3,3,3,3]
@kapilkumarsangwan6119
@kapilkumarsangwan6119 2 жыл бұрын
no it will not , firstly have a look on the if condition of the code
@ferozqureshi5228
@ferozqureshi5228 2 жыл бұрын
it’ll simply return 1.
@rohit-ld6fc
@rohit-ld6fc 2 жыл бұрын
does not work for [3,4,-1,1]
@likithareddy3025
@likithareddy3025 2 жыл бұрын
yes
@ashwinirathi238
@ashwinirathi238 Жыл бұрын
@@likithareddy3025 @rohit yes this code not work for such case for that we have to made the change like and whihc makes it o(n^2) so not optimal n = len(nums) j=n while j: right_palace =True for i in range(n): element=nums[i] if element>=1 and element
@gaurav4270
@gaurav4270 Жыл бұрын
It works make sure ur decrementing i after swapping
@CricketGalaxy07-18
@CricketGalaxy07-18 2 жыл бұрын
thanks
@GAURAV-ct9pl
@GAURAV-ct9pl Жыл бұрын
thank you
@GAURAV-ct9pl
@GAURAV-ct9pl Жыл бұрын
mam, can you please tell me why can't we use swap(element,nums[chair]) instead of swap(nums[i],nums[chair])
@sunnyseconds
@sunnyseconds Жыл бұрын
nums=[3,4,-1,1] def funcpos(nums): n = len(nums) i=0 for i in range(n): element=nums[i] if element>=1 and element
@ashwinirathi238
@ashwinirathi238 Жыл бұрын
your code is not working because i=1-1 not impacted to original loop i variable i think this sol is not optimal, i did some modification you can check n = len(nums) j=n while j: right_palace =True for i in range(n): element=nums[i] if element>=1 and element
@aizad786iqbal
@aizad786iqbal 10 ай бұрын
I didn't understood the i-- part.. you were going to explain with an example then you stopped..
@reshmamaam1451
@reshmamaam1451 3 жыл бұрын
💯💯💯💯💯
@connecttorohit
@connecttorohit 2 жыл бұрын
@VivekKumar-lc3vg
@VivekKumar-lc3vg 2 жыл бұрын
❤️
@codingmaster7735
@codingmaster7735 9 ай бұрын
i love you
@AmarjeetKumar-to9ub
@AmarjeetKumar-to9ub 2 жыл бұрын
6:25
@anuragdutt36
@anuragdutt36 Жыл бұрын
We Don't care.
@abhishekpati2006
@abhishekpati2006 Жыл бұрын
one of the most worst explanation 🤮
@akshatkaushik2037
@akshatkaushik2037 2 жыл бұрын
Line 6: Char 29: runtime error: signed integer overflow: -2147483648 - 1 cannot be represented in type 'int' (solution.cpp) SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior prog_joined.cpp:15:29 help for this error
@debayanbiswas3563
@debayanbiswas3563 2 жыл бұрын
Take chair and element as long
@shashwatchawla
@shashwatchawla 2 жыл бұрын
@princepal9886
@princepal9886 Жыл бұрын
Thanks
@Vipulghadi
@Vipulghadi Жыл бұрын
BS-16. Kth Missing Positive Number | Maths + Binary Search
22:52
take U forward
Рет қаралды 179 М.
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
36:55
bayGUYS
Рет қаралды 1,9 МЛН
Мен атып көрмегенмін ! | Qalam | 5 серия
25:41
Minimum Swaps to sort intuition + code C++ with explanation
15:25
Code with Alisha
Рет қаралды 25 М.
Amazon Coding Interview Question - First Missing Positive (LeetCode)
20:47
How a Russian student invented a faster multiplication method
18:48
Find the Missing and Repeating Number | 4 Approaches 🔥
42:24
take U forward
Рет қаралды 200 М.
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
36:55
bayGUYS
Рет қаралды 1,9 МЛН