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!!!🙂🙂🙂
@dipanshu2662 жыл бұрын
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.
@angadrajsingh43112 жыл бұрын
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 Жыл бұрын
Nice, I made this one change to the code and it went good
@alphabeta6442 ай бұрын
This was the best described solution for this problem, after I tried searching and went through at least 5 other solutions.
@AlgorithmsMadeEasy2 ай бұрын
Thank you!!
@araneuskyuroАй бұрын
Thank you Ma'am. This helped me a lot. Clear, concise explanation!
@shubhamkamdi66062 жыл бұрын
You made this so easy to understand, I just couldn’t understand any of the algos on the other leetcode guide channels.
@AlgorithmsMadeEasy2 жыл бұрын
Most welcome!! happy to help
@rahulcajetandcosta5430Ай бұрын
Thank you ur explanation was clear and simple to understand
@rishabh021262 жыл бұрын
Thanks for such an informative video. Your way of explaining the problem was quite simple and hence easy to grab the solution.
@AlgorithmsMadeEasy2 жыл бұрын
Glad it helped
@ayushikhandal4874Ай бұрын
good solution !! much better than others !!
@codebits21202 жыл бұрын
So far smart explanation 😁,I was thinking it very complex way
@AlgorithmsMadeEasy2 жыл бұрын
Glad it was helpful!
@karanalang15733 жыл бұрын
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
@rohithchittibommala20023 жыл бұрын
at 2:36 next highest number is 5 not 4
@AlgorithmsMadeEasy3 жыл бұрын
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.
@rohithchittibommala20023 жыл бұрын
@@AlgorithmsMadeEasy yes
@aanishas19258 күн бұрын
Thank you, you have named your channel right 😊
@kshitijgarg2609 Жыл бұрын
best explanation
@AlgorithmsMadeEasy Жыл бұрын
Thanks for liking
@AnaGuerra03Ай бұрын
great video, thank you
@RitikSingh-bt3gp3 жыл бұрын
great explanation but please take more test cases for a clear cut understanding. Thanks!
@vashishth_042 жыл бұрын
well explained
@lovneetchugh80632 жыл бұрын
best explanation so far
@vasugaur12833 жыл бұрын
great explanation worth watching your videos
@AlgorithmsMadeEasy3 жыл бұрын
Thanks !! Glad you like our videos !!
@deeptidip9864 Жыл бұрын
Bestest explanation♥️♥️
@AlgorithmsMadeEasy Жыл бұрын
Thanks a lot 😊
@vijayakumareyunni6010 Жыл бұрын
Good explanation of steps
@vikupilot3 жыл бұрын
Very well explained which I want.
@AlgorithmsMadeEasy3 жыл бұрын
Thanks !!
@_HarshitSharma2 жыл бұрын
Best Explanation for this Question on YT so far. Thankyou @AlgorithmsMadeEasy :)
@AlgorithmsMadeEasy2 жыл бұрын
Glad it was helpful!
@RaushanKumar-vc1qu3 жыл бұрын
Just awesome ma'am
@AlgorithmsMadeEasy3 жыл бұрын
Thanks !!
@carefree_ladka11 ай бұрын
In second example , how is 4 next is higher number in the left array as we have 5?
@gamingbar38813 жыл бұрын
In line 9, it should be nums[j] >= nums[i]... because we are finding the next greater element of nums[i].
@andressalazargaleano64193 жыл бұрын
excellent explaination
@AlgorithmsMadeEasy3 жыл бұрын
Thanks Andrés!! 🙂🙂
@jungyunjo37122 жыл бұрын
Thank you! It helped me
@adarshjoshi60182 жыл бұрын
Please tell me why did you started i pointer with arr.length - 2; ????
@rohitkumarsingh31223 жыл бұрын
Nice explaination
@AlgorithmsMadeEasy3 жыл бұрын
Thanks, Rohit!!
@AP-eh6gr11 ай бұрын
good solution!
@mrjava182 жыл бұрын
Man......that's Dope...!!!😍
@AlgorithmsMadeEasy2 жыл бұрын
Thanks !!
@swarnavachakraborty7644 Жыл бұрын
2:02 it's increasing from end, not decreasing
@revanthrajashekar59833 жыл бұрын
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
@soheekim59272 жыл бұрын
love the video!
@midhurammanoj9313 жыл бұрын
Thanks!
@praveenanand56892 жыл бұрын
will sorting work instead of reversing ?
@shreyanshjamuar89213 жыл бұрын
Amazing
@AlgorithmsMadeEasy3 жыл бұрын
Thank you! Glad you liked it !!
@INDRASENAREDDYCBME Жыл бұрын
at 2:29 5 is greater than 4 right?
@lukearnold675411 ай бұрын
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.
@soumyajitchatterjee58223 жыл бұрын
For your code why did you set your int i to array.size()-2? IS there a specific reason.
@AlgorithmsMadeEasy3 жыл бұрын
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.
@abhishekbehera21936 ай бұрын
Finally someone explained it well!!!
@nithinsharma76232 жыл бұрын
can u please explain int i =num.length - 2 and j = num.length - 1 in the progrem
@ankuranubhav19282 жыл бұрын
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
@thelast22333 жыл бұрын
What's your codeforces id?
@9-1939 Жыл бұрын
👌
@abhishekranjan10943 жыл бұрын
Mam please reply..how I'll solve [3,2,1]
@harshitsaluja34932 жыл бұрын
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.
@sggffdgcx37693 жыл бұрын
Are you mad what is decreasing and what is increasing
@gamingbar38813 жыл бұрын
In line 9, it should be nums[j] >= nums[i]... because we are finding the next greater element of nums[i].. Right??
@guo75802 жыл бұрын
@@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.