That second one took me a while to find the pattern. For anyone struggling, here's an example for n=59884848459853: Basically, you: 1) loop through the number in list form backwards until you find a number smallest than the previous (example: 5-9853). Once you do: 2) you loop again backwards only on the part to the right of that number (example: 9853), until you find a number greater than the number (example: 8). Once you find it, swap them (example becomes: 598848484-89553). 3) Finally, reverse the part after the number you just swapped (example: 8-9553 becomes 8-3559). And you have the solution: 59884848483559. That was quite the exercise, thanks for these videos, I don't usually have the motivation to do these on my own. Hope to see more in the future!
@pronobgogoi20639 күн бұрын
NeuralNine, please do more of these codewars. Helps a lot to understand how to approach a problem. Also, I am glad I came across your channel. 👍
@pronobgogoi20639 күн бұрын
Man, the last one was an adventure. Keep them coming!!!
@cybermanne9 күн бұрын
In that second loop, when you are looking for the smallest digit that is still bigger than the digit you found in the first loop, you can just go from right to left and take the first digit that is bigger. This digit will also be the smallest (because otherwise the algorithm would've found another another digit to swap in the outer loop). So you don't need to go thru the rest of the digits and see if you can find a smaller digit.
@sp5xyz12 күн бұрын
great video, thanks!
@R56A10 күн бұрын
Thanks for the video, it is really valuable to me.
@bobby_ridge11 күн бұрын
why isbn-10 seems so hard if this kata should be solved in 1-3 lines?
@myst989012 күн бұрын
18:10 I made the exact same mistake (and some more)
@rubanruban984312 күн бұрын
Its nice but can you explain about machine learning and deep learning models usin streamlit
@nd702412 күн бұрын
Just FYI codewars don't like it when you share your solutions off the platform