Next Permutation | Live Coding with Explanation | Leetcode - 31

  Рет қаралды 31,075

Algorithms Made Easy

Algorithms Made Easy

Күн бұрын

Пікірлер: 70
@AlgorithmsMadeEasy
@AlgorithmsMadeEasy 3 жыл бұрын
We hope you all are enjoying our videos!!! Don't forget to leave a comment!!! Please like the video to support us!!! Questions you might like: ✅✅✅[ Tree Data Structure ] : kzbin.info/aero/PLJtzaiEpVo2zx-rCqLMmcFEpZw1UpGWls ✅✅✅[ Graphs Data Structure ] : kzbin.info/aero/PLJtzaiEpVo2xg89cZzZCHqX03a1Vb6w7C ✅✅✅[ December Leetcoding Challenge ] : kzbin.info/aero/PLJtzaiEpVo2xo8OdPZxrpybGR8FmzZpCA ✅✅✅[ November Leetcoding Challenge ] : kzbin.info/aero/PLJtzaiEpVo2yMYz5RPH6pfB0wNnwWsK7e ✅✅✅[ August Leetcoding Challenge ] : kzbin.info/aero/PLJtzaiEpVo2xu4h0gYQzvOMboclK_pZMe ✅✅✅July Leetcoding challenges: kzbin.info/aero/PLJtzaiEpVo2wrUwkvexbC-vbUqVIy7qC- ✅✅✅June Leetcoding challenges: kzbin.info/aero/PLJtzaiEpVo2xIfpptnCvUtKrUcod2zAKG ✅✅✅May Leetcoding challenges: kzbin.info/aero/PLJtzaiEpVo2wRmUCq96zsUwOVD6p66K9e ✅✅✅Cracking the Coding Interview - Unique String: kzbin.info/aero/PLJtzaiEpVo2xXf4LZb3y_BopOnLC1L4mE Struggling in a question?? Leave in a comment and we will make a video!!!🙂🙂🙂
@dipanshu266
@dipanshu266 2 жыл бұрын
Nicely Explained. I had seen so many videos for this question but your way of explaining this question was different from others and awesome too.
@angadrajsingh4311
@angadrajsingh4311 2 жыл бұрын
best explanation so far.. Thanks. However if you reduce the movement of j til j > i rather that j >= 0, time will go 0ms and 100% fast as the required range for us is i to j only.
@davidlalmuanpuiasailo3366
@davidlalmuanpuiasailo3366 Жыл бұрын
Nice, I made this one change to the code and it went good
@alphabeta644
@alphabeta644 2 ай бұрын
This was the best described solution for this problem, after I tried searching and went through at least 5 other solutions.
@AlgorithmsMadeEasy
@AlgorithmsMadeEasy 2 ай бұрын
Thank you!!
@araneuskyuro
@araneuskyuro Ай бұрын
Thank you Ma'am. This helped me a lot. Clear, concise explanation!
@shubhamkamdi6606
@shubhamkamdi6606 2 жыл бұрын
You made this so easy to understand, I just couldn’t understand any of the algos on the other leetcode guide channels.
@AlgorithmsMadeEasy
@AlgorithmsMadeEasy 2 жыл бұрын
Most welcome!! happy to help
@rahulcajetandcosta5430
@rahulcajetandcosta5430 Ай бұрын
Thank you ur explanation was clear and simple to understand
@rishabh02126
@rishabh02126 2 жыл бұрын
Thanks for such an informative video. Your way of explaining the problem was quite simple and hence easy to grab the solution.
@AlgorithmsMadeEasy
@AlgorithmsMadeEasy 2 жыл бұрын
Glad it helped
@ayushikhandal4874
@ayushikhandal4874 Ай бұрын
good solution !! much better than others !!
@codebits2120
@codebits2120 2 жыл бұрын
So far smart explanation 😁,I was thinking it very complex way
@AlgorithmsMadeEasy
@AlgorithmsMadeEasy 2 жыл бұрын
Glad it was helpful!
@karanalang1573
@karanalang1573 3 жыл бұрын
good short video .. however, it will be good if you provide info on reason why the steps get the next permutation as well .. btw, the same detail should be present in all other videos as well
@rohithchittibommala2002
@rohithchittibommala2002 3 жыл бұрын
at 2:36 next highest number is 5 not 4
@AlgorithmsMadeEasy
@AlgorithmsMadeEasy 3 жыл бұрын
We need the number just greater than 1 and not the highest number to form the next permutation. In the array the next higher number after 1 is 4 and not 5. Hope this clears up the doubt.
@rohithchittibommala2002
@rohithchittibommala2002 3 жыл бұрын
@@AlgorithmsMadeEasy yes
@aanishas1925
@aanishas1925 8 күн бұрын
Thank you, you have named your channel right 😊
@kshitijgarg2609
@kshitijgarg2609 Жыл бұрын
best explanation
@AlgorithmsMadeEasy
@AlgorithmsMadeEasy Жыл бұрын
Thanks for liking
@AnaGuerra03
@AnaGuerra03 Ай бұрын
great video, thank you
@RitikSingh-bt3gp
@RitikSingh-bt3gp 3 жыл бұрын
great explanation but please take more test cases for a clear cut understanding. Thanks!
@vashishth_04
@vashishth_04 2 жыл бұрын
well explained
@lovneetchugh8063
@lovneetchugh8063 2 жыл бұрын
best explanation so far
@vasugaur1283
@vasugaur1283 3 жыл бұрын
great explanation worth watching your videos
@AlgorithmsMadeEasy
@AlgorithmsMadeEasy 3 жыл бұрын
Thanks !! Glad you like our videos !!
@deeptidip9864
@deeptidip9864 Жыл бұрын
Bestest explanation♥️♥️
@AlgorithmsMadeEasy
@AlgorithmsMadeEasy Жыл бұрын
Thanks a lot 😊
@vijayakumareyunni6010
@vijayakumareyunni6010 Жыл бұрын
Good explanation of steps
@vikupilot
@vikupilot 3 жыл бұрын
Very well explained which I want.
@AlgorithmsMadeEasy
@AlgorithmsMadeEasy 3 жыл бұрын
Thanks !!
@_HarshitSharma
@_HarshitSharma 2 жыл бұрын
Best Explanation for this Question on YT so far. Thankyou @AlgorithmsMadeEasy :)
@AlgorithmsMadeEasy
@AlgorithmsMadeEasy 2 жыл бұрын
Glad it was helpful!
@RaushanKumar-vc1qu
@RaushanKumar-vc1qu 3 жыл бұрын
Just awesome ma'am
@AlgorithmsMadeEasy
@AlgorithmsMadeEasy 3 жыл бұрын
Thanks !!
@carefree_ladka
@carefree_ladka 11 ай бұрын
In second example , how is 4 next is higher number in the left array as we have 5?
@gamingbar3881
@gamingbar3881 3 жыл бұрын
In line 9, it should be nums[j] >= nums[i]... because we are finding the next greater element of nums[i].
@andressalazargaleano6419
@andressalazargaleano6419 3 жыл бұрын
excellent explaination
@AlgorithmsMadeEasy
@AlgorithmsMadeEasy 3 жыл бұрын
Thanks Andrés!! 🙂🙂
@jungyunjo3712
@jungyunjo3712 2 жыл бұрын
Thank you! It helped me
@adarshjoshi6018
@adarshjoshi6018 2 жыл бұрын
Please tell me why did you started i pointer with arr.length - 2; ????
@rohitkumarsingh3122
@rohitkumarsingh3122 3 жыл бұрын
Nice explaination
@AlgorithmsMadeEasy
@AlgorithmsMadeEasy 3 жыл бұрын
Thanks, Rohit!!
@AP-eh6gr
@AP-eh6gr 11 ай бұрын
good solution!
@mrjava18
@mrjava18 2 жыл бұрын
Man......that's Dope...!!!😍
@AlgorithmsMadeEasy
@AlgorithmsMadeEasy 2 жыл бұрын
Thanks !!
@swarnavachakraborty7644
@swarnavachakraborty7644 Жыл бұрын
2:02 it's increasing from end, not decreasing
@revanthrajashekar5983
@revanthrajashekar5983 3 жыл бұрын
That's an excellent explanation. However, in the second while loop, I think it should be while(j > 0) and not j >=0. For the input [1, 1], j gets -1 and the -1 index is used during swapping, which is OOB
@soheekim5927
@soheekim5927 2 жыл бұрын
love the video!
@midhurammanoj931
@midhurammanoj931 3 жыл бұрын
Thanks!
@praveenanand5689
@praveenanand5689 2 жыл бұрын
will sorting work instead of reversing ?
@shreyanshjamuar8921
@shreyanshjamuar8921 3 жыл бұрын
Amazing
@AlgorithmsMadeEasy
@AlgorithmsMadeEasy 3 жыл бұрын
Thank you! Glad you liked it !!
@INDRASENAREDDYCBME
@INDRASENAREDDYCBME Жыл бұрын
at 2:29 5 is greater than 4 right?
@lukearnold6754
@lukearnold6754 11 ай бұрын
We need the number just greater than 1 and not the highest number to form the next permutation. In the array the next higher number after 1 is 4 and not 5.
@soumyajitchatterjee5822
@soumyajitchatterjee5822 3 жыл бұрын
For your code why did you set your int i to array.size()-2? IS there a specific reason.
@AlgorithmsMadeEasy
@AlgorithmsMadeEasy 3 жыл бұрын
Because the comparison of indexes is between i and i+1 starting from the rear end. If we would take i as size-1, we would get an IndexOutOfBoundsException for size as at that point we would be comparing indexes size-1 and size.. Hope this helps.
@abhishekbehera2193
@abhishekbehera2193 6 ай бұрын
Finally someone explained it well!!!
@nithinsharma7623
@nithinsharma7623 2 жыл бұрын
can u please explain int i =num.length - 2 and j = num.length - 1 in the progrem
@ankuranubhav1928
@ankuranubhav1928 2 жыл бұрын
i is the 2nd last element and j is the last. So we start from the second last and then compare it with the last as a starting point to find the Point of change
@thelast2233
@thelast2233 3 жыл бұрын
What's your codeforces id?
@9-1939
@9-1939 Жыл бұрын
👌
@abhishekranjan1094
@abhishekranjan1094 3 жыл бұрын
Mam please reply..how I'll solve [3,2,1]
@harshitsaluja3493
@harshitsaluja3493 2 жыл бұрын
When we try to sort this array as the array the point of change is from the starting you need to either sort the whole array or reverse the whole array.
@sggffdgcx3769
@sggffdgcx3769 3 жыл бұрын
Are you mad what is decreasing and what is increasing
@gamingbar3881
@gamingbar3881 3 жыл бұрын
In line 9, it should be nums[j] >= nums[i]... because we are finding the next greater element of nums[i].. Right??
@guo7580
@guo7580 2 жыл бұрын
@@gamingbar3881 I don’t think so. Just swap the found element with the one right higher than it from the remaining right-handed sequence. So just proceed with it until nums[j] > nums[i] for exiting while loop.. this j is where we want to swap to.
Longest Valid Parentheses | Live Coding with Explanation | Leetcode - 32
12:51
Algorithms Made Easy
Рет қаралды 49 М.
NEXT PERMUTATION | LEETCODE # 31 | PYTHON OPTIMAL SOLUTION
18:50
Cracking FAANG
Рет қаралды 9 М.
ПРИКОЛЫ НАД БРАТОМ #shorts
00:23
Паша Осадчий
Рет қаралды 2,4 МЛН
Dad Makes Daughter Clean Up Spilled Chips #shorts
00:16
Fabiosa Stories
Рет қаралды 7 МЛН
escape in roblox in real life
00:13
Kan Andrey
Рет қаралды 6 МЛН
Rotate Image | Live Coding with Explanation | Leetcode - 48
10:12
Algorithms Made Easy
Рет қаралды 8 М.
Leetcode - Next Permutation (Python)
9:09
Timothy H Chang
Рет қаралды 11 М.
Top 7 Algorithms for Coding Interviews Explained SIMPLY
21:22
Codebagel
Рет қаралды 371 М.
Google Coding Interview With A Facebook Software Engineer
49:59
Clément Mihailescu
Рет қаралды 934 М.
Google Coding Interview With A High School Student
57:24
Clément Mihailescu
Рет қаралды 4,1 МЛН
Next Permutation | Leet code 31 | Theory explained + Python code
19:19
Sai Anish Malla
Рет қаралды 14 М.
Candy | Live Coding with Explanation | Leetcode -135
18:09
Algorithms Made Easy
Рет қаралды 14 М.
ПРИКОЛЫ НАД БРАТОМ #shorts
00:23
Паша Осадчий
Рет қаралды 2,4 МЛН