Ad
  • Custom User Avatar

    Hmm... Okay, it seems that my program somehow mishandles the division operator...

  • Custom User Avatar

    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 write double.Parse([number], CultureInfo.InvariantCulture) instead of double.Parse([number]), but this results in the error src/Solution.cs(51,49): error CS0103: The name ‘CultureInfo’ does not exist in the current context. Can anyone suggest how to fix this problem?

  • Custom User Avatar

    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.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    I don't quite understand your problem, but the rules should be the same for all ships.

  • Custom User Avatar

    And I thought I was the one with the sloppy code.....

  • Custom User Avatar

    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.

  • Custom User Avatar

    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”.