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.
Hmm... Okay, it seems that my program somehow mishandles the division operator...
I've got a problem.
My code seems to work correctly, at least it passes tests with integer operands in CodeWars and my personal tests with double operands in Visual Studio.
However, on CodeWars it displays the error
System.FormatException : Input string was not in a correct format.
. As I understand it, this is due to the locale and the fact that due to my location double.Parse doesn't work if the string uses a period instead of a comma. I tried to writedouble.Parse([number], CultureInfo.InvariantCulture)
instead ofdouble.Parse([number])
, but this results in the errorsrc/Solution.cs(51,49): error CS0103: The name ‘CultureInfo’ does not exist in the current context
. Can anyone suggest how to fix this problem?A hundred lines...
But performance seems to be just fine: my program counted the number of all ones from 1 to 999999999999999999 instantly.
It was a very interesting kata, I liked it.
Solved the task using permutations with repetition.
This comment is hidden because it contains spoiler information about the solution
I don't quite understand your problem, but the rules should be the same for all ships.
And I thought I was the one with the sloppy code.....
You should add tests to this kata to check the function for working with arrays of one element. The solution of some participants (e.g. ElectroYan user) returns the correct result when using a multi-item array as an argument, but returns the wrong result when using a single-item array as an argument.
This problem was found in the C# version, but I think it's the same in versions for other languages.
Your code doesn't work correctly with arrays that have only one argument.
For example, Extract(new int[] { 1 }) returns “1,1” even though it should return “1”.