in task description: think about performance...
think about performance
Very similar to mine. I feel like I'm on the good track. (at least in making the solution short) :)
And whilst on that subject, there are also no example test cases (why not just trivially copy the static tests over???), the description has not been updated for F# syntax, and of the 4 tests that do exist, 2 of them pass simply by running the initial solution that defaults to returning 0
F# translation is terrible - no random tests (I trivially hardcoded a brute force solution since there are 4 static tests), and the function name max diff is really bad practice - just because you can include a space in a function name does not make it a good idea.
How did this translation ever get approved?
It's a slow solution but I like the logic displayed here. I had a brainf**k moment reading this.
short, but definitely that is not about performance at all. You sort the whole array. There are better solution below
oh, I see that, now. Thank you for taking the time and sorry about that.
In the code you posted, you forgot the () after sort and it wasn't actually sorting anything.
Sorry about that, next time I'll post as Question. Thank you for your reply. In the next comment I'll post my code and mark as having spoiler content.
I've just solved it in Python and there was no problem for me, a problem with your code should use Question label instead, read this, see how to post your code so we can see what's wrong with it.
Hi, I'm new to programming and new here, so I apologize if I'm doing something dumb, but my code passes on the first tests, except this one:
test.assert_equals(max_diff([-0, 1, 2, -3, 4, 5, -6]), 11);
this is weird because if I run it on my computer or in http://pythontutor.com/visualize.html I get the right answer, but somehow in codewars, it returns -6 instead of 11. Is it possible that my code actually works and that it's a problem with the kata? I'm using python 3.6. Thank you.
Why does there have to be a million different ways to do the same thing!!!! and why is this one so much simpler then mine!!
i needed this to understand as well, now it makes sense :D
ah, ok thanks!