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.
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.
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.
As long as he code works, and is easy to maintain, it is fine.
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:
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:Also, they have to be very clear about which "built-in" things they don't want then.
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.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.
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.
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.
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.
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.
Because your code is wrong. Read the description of the Kata again.
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.No, I mean you are using the
max
andmin
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
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...