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.
Hi, thank you for the kata. I got fooled for the same reason as examples were not updated in C#.
@felyxjet thank you for this comment, I knew strings were immutable but didn't put together that it meant creating a new string every time.
Does this mean that using the str.join() method is like using the list.append() method?
TIA!
Which is the number of the test you don't pass? (1st, 2nd, 3rd... ?) Fixed tests or random tests?
I tried with an error and it seems that when a test fails the
(println strng arr)
doesn't work at CW.It is not an issue of the kata but of your code.
If when printing you don't see anything what could that be?-) Did you think of possible corner case(s)?
You're right, and also as you noted it, defining
two_count
asc
helps to shorten code size.Aiming to the smallest code is a recreational programming exercise called code golfing and codewars kumite is a good way to exchange tips about it and post shorter and shorter solutions by forking them.
Recursive function
Hmm... black magic? :D
More seriously, it is a recursive solution that adds one to the result if the right bit of current
n
is equal to 0.Then n is divided by 2 and the next bit is checked.
I must also thank you for remembering me this solution because I was able to made a shorter one, feel free to have a look!
This one added:
For
product = 581
, the output should be-1
.No valid result found.
Someone says the output should be
783
, because7 x 83 = 581
.Please note:
83
is not a DIGIT.I naively thought that the user would notice that the result of this example is not
119
but-1
OK, I will add a example
581
in the description ;-)Sorry, but I don't think so. description is clear enough ;-)
7*83? 83 is not a digit ;-)
Fancy enough, but as you noticed, not exactly production code ;)
Cheers :)
As it seems, they've fixed that a long time ago, and now str1 + str2 should work as fast in most cases. #http://stackoverflow.com/a/12171382
I can see that exact example as a third example test case, actually...
Edit: in JS, let me update the rest.
Aren't the one in the description and the example test cases a good idea of how to proceed?
Loading more items...