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.
Very nice kata to solve, pretty better using a mathematical approach sometimes.
Looks good! ( not that I really know Lua, but it's quite readable :)
Lua translation!
C Translation (author inactive).
Who voted
4kyu
on this, lolIt would be worthwhile to include handling of edge cases at the beginning of the solution. You need to make sure that the function handles edge cases correctly, such as when a or b is 1.
An example of handling edge cases:
def number_of_sets(a, b):
Nevermind. I just had to replace "BigInt(Math.pow(3, n))" with "3n ** n"
For JS, for the big random test, I get it wrong, yet when I go to check if the sum of powers of three is equal to n, it says it is. So how did I get it wrong while at the same time getting the sum correct? Am I just missing something? Also this is one of the test I failed:
n = 233704777590876905525308351295: expected '0-0--++-+0++00-0-+0-0-0+-00--0+0+--++…' to equal '-+00-+++00+0-+-0+++-000-++++-0+0+--++…'
Fixed now.
Yep
Should be fixed.
I'm incapable of fixing this. I hope monadius can have a look at this.
( JS )
Reference solution is wrong.
Actually, the JS ref sol was incorrect for negative numbers. Updated.
Loading more items...