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.
Not to mention the performance characteristics on finite lists.
O(n)
is possible, why vote anO(n log n)
solution Best Practice?I stand corrected
It does.
When both letters are in upper case, both calls to char.IsLower() will return false.
false == false resolves to true, so the function returns 1.
This does not account for the case when both letters are upper and should return 1.
Please use spoiler flag next time.
This comment is hidden because it contains spoiler information about the solution
Impressive
This comment is hidden because it contains spoiler information about the solution
Of course, I was just commenting because for me, as a mathematician, it was on the first glance confusing that this actually works :D
To be fair, the type definition is Int -> Int, not (Num a) => a -> Int, so a Double would never be allowed into the function.
Note that this definition would not work for Double, e.g. 2.25=1.5^2 would be sent to 2^2=4, because 1.5 gets rounded to 2, although 2.25 is closer to 1 than to 4.
Unfortunately, it's
O(n²)
whenO(n log n)
is possible.Fixed.
Done.
True, I don't remember why I didn't do that
Loading more items...