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.
My solution was 50 lines... bruh
Didn't know about those substring methods
why make a wrong description of the kata? You could just write, remove all the spaces and $ and turn it into a double. If examples like " -$$30 $$$20 $2$ "
This solution has me stumped. I totally don't get how this works.
Simply amazing
Can be
it.code
orit.digitToInt()
to be more clearThis soluiton does not work in Kotlin v.1.5. The fix is to replace maxBy with maxByOrNull, or switch to version 1.3.
Such inconsistency is very surprising to me.
great solution. I hate you! Great job.love how clean the .drop and adding .first are!
I don't see this as the biggest flaw here - the conversion to a char and then to an int and using sum is way to complicated. Just use sumBy directly on the String (no need to get the CharArray at all!) and define the summing value to be Character.getNumericValueOf(c). Done.
This is not so "clever" as some people pointed out. :-) And it's not a best practice to do it with more steps than necessary.
It's not, it just converts it from a character to an integer; it seems that cubing a sequence before summing it doesn't change whether the sum will be divisible by 2! Quite a nice observation, and requires less work.
Pretty good, didnt think about this. I was focused more on the regex element.
sumBy on String. Clever indeed ^^
hmm, I guess I've done match the same, but more complicated :) Nice solution https://www.codewars.com/kata/reviews/5a5e23c47635599816000ac8/groups/5d166b37fdfc750001de6dd3
Cool: using toDoubleOrNull instead of catching the exception
Not so much: Two replace passes instead of one with a regex