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.
Same story here. The shortest code has always the best ratings. What about readability and performance?
my mistake. your solution is correct. max function returns the first occurrence in case of a tie.
your solution fails the following rule: "If two words score the same, return the word that appears earliest in the original string".
that's a clever solution from a mathematical point of view. however, from a computational view, which is more efficient: checking 3 inequalities or sorting and one inequality?
is there a proof that we don't need to check for zero or negative values?
This comment is hidden because it contains spoiler information about the solution
not efficient
very concise solution. however it takes 2 * len(arr).
will return a float not an integer
if n and m > 0 is a wrong expression. example: if -5 and 3 > 0, will result in True. it is equivalent to if (-5) and (3>0)
clever but not readable.