Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
I think they prefer to avoid it because its easy to get lost in it ....
But it's a nice feature! I really love it
Clever solution but recursion not ideal in production where code needs to be preformant... most developers prefer to avoid it. But for the purpose of the exercise, great job.
No, it doesn't.
It fails in some test cases....example 10001
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
It's called recursion.
I'm new to programming. Can someone please explain why the function "reverseNumber" was used in the "reverseNumber" function itself? Or can someone please guide me in the right direction as to what this process is called so that I can read more about what this does and when it should be implemented?
smooth 👏
The recursive call is especially nice!
I'll never understand why beginners try to shoehorn cs101 everywhere. Changing data types doesn't affect Big-O complexity. And trying to speed up things based on general rules without benchmarking just leads to complex and slow code.
Yes, memory allocations take time, but when you are using python, everything takes time. It's a very slow language. Keeping the no. of interpreted steps to a minimum will often outspeed lower memory allocations.
Here's a fun exercise. Try benchmarking my solution and yours.
ok, so, as usual, this is context dependent...
From a cs perspective, every time you change a data type new memory is allocated and time complexity is increased (Big-O). Python does memory management under the hood, so it is easy to ignore. In a lot of ways the brilliance of the Python interpreter is that is this black box that you throw code into and it does some magic and spit out what you asked for. This is a big topic, though, more than a comment forum. If you are working with small data in a low use environment, memory managment isn't a big deal. If you are paying the AWS bill, best practices become real important.
I'm curious to know why it would be so..........
clever, yes, but best practice would not include changing data type (int -> str).