Ad
  • Custom User Avatar

    The hardest things in this kata is knowing how sorting works differently depending on data type. After that it is fairly simple with a bit of string and array knowledge.

  • Custom User Avatar

    The hardest things in this kata is knowing how sorting works differently depending on data type. After that it is fairly simple with a bit of string and array knowledge.

  • Custom User Avatar

    As long as he code works, and is easy to maintain, it is fine.

  • Custom User Avatar

    It is a very common mistake people make in this kata. You now have to learn the difference between sorting a list of strings and sorting a list of numbers. Have fun!

    Here is a full comparison as an example:

     Int   String
     542   6       MAX
      54   542
      29   54
       6   5
       5   4
       4   4
       4   29
       1   1
       0   0
      -3   -64
      -6   -6
     -64   -3
    -214   -214    MIN
    
  • Custom User Avatar

    Then they just want to see if you know how to make a foreach loop. All I know about interview programmer tests, is that they want to see if you are familiar with basic functions and when to use them, for example:

    • Loops
    • Modulus
    • etc.

    Also, they have to be very clear about which "built-in" things they don't want then.

  • Custom User Avatar

    The hidden tests contain plenty of those. The sample test case intentionally only contains that one Assert.That(Kata.MakeNegative(42), Is.EqualTo(-42)) test as my attempt to teach people to write their own test cases.

  • Custom User Avatar

    I don't know much Python, but my immediate guess is just different versions of Python.

    Either way, this is an issue in CodeWars, not this kata. I am going to mark this as resolved.

    I suggest you make a bug report to CodeWars, or ask on the Discord server.

  • Custom User Avatar

    Code is fun. As long as it works, is easy to read and maintain, it doesn't matter how it is written.

    If you can read it and maintain it, then don't worry about rather it is "correct". If you are worried that others won't be able to read and maintain your code, discuss what coding standards you should use on your team.

    If you write code that looks horrible and is hard to understand, it can either get you in trouble or give you job security, it depends on the environment you are in.

  • Custom User Avatar

    It is in the description and it can be seen in the example usage code. I guess I could write is extra clearly, but it is mentioned.

    The kata was made for C# first of all, which is strongly typed, so there never was a question about what you need to return back then. Which programming language were you using? Maybe I can make it more clear from the inital state of the code too.

  • Custom User Avatar

    Strings are easy to understand and almost always the same in all programing languages.

    It also helps teach people how to split a string and convert it to the correct type.

    To be fair, I made this kata so long ago that I don't remember the exact reasons, but it has definitely been good for the above mentioned reasons.

  • Custom User Avatar

    It is just a variable name, it doesn't matter what it is called. If it helps you read it, you can do a rename of it when you are reading it.

  • Custom User Avatar

    Because your code is wrong. Read the description of the Kata again.

  • Custom User Avatar

    Skill issue?

    But yes, this would be a lot easier if the method/function took an int array as input. But then this kata would be even easier and not as fun.

  • Custom User Avatar

    No, I mean you are using the max and min functions on a list of strings. The way you sort a list of strings is different form how you sort a list of numbers.

    See: https://www.codewars.com/kata/554b4ac871d6813a03000035/discuss#60cb692f9c75d0003d7b9a79

  • Custom User Avatar

    Which programming language is this?

    The issue is definitely your code, and my first guess is that you are sorting a list of strings, instead of a list of numbers.

    Other than that, you are doing things in a loop for some reason, so you are finding the highest and lowest values multiple times.

  • Loading more items...