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.
Interesting...
You can use this "trick" in any translated language of this kata. So I'm sure it's a valid/expected solution.
Cheating!!:)
It wouldn't be 6kyu level kata if you could use anything like
BigInt
.This comment is hidden because it contains spoiler information about the solution
... but completely unreadable and a maintenance nightmare. I'd say stay away from such things in a production environment!
I also did a similar solution but got error that BigInt is not available and did not know that I can import it in codewars. Then I went with a solution that is similar top voted so I guess I nailed it :)
A recursive version if not optimized at compile time generate extra assemby instruction for creating/destroying a stack context for a function call. The context contains temporary variable, caller arguments, and the return for the instruction pointer. Iterative version keeps the same stack context, no need to manage life cycle of called context, so it's faster cause less instructions to execute.
A teminal recusion can be easily optimized at compile time can be do by «de-recursivate», i.e. transform a recusive algorithm by an iterative one through the use of its own stack with a fast use of this stack. GCC do that for example.
why? Is it not good for performance?
Точняк, тесты нужно подправить.
I had no idea you can import libraries into CodeWars. Thanks for showing me that.
I don't see the cases: a + (b * c) and (a + b) * c here... am I missing something?
Maybe, iterative version is easy too: https://www.codewars.com/kata/reviews/5d6ddad7e78d210001f76504/groups/5d809b2c01af06000163ed61 .
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Loading more items...