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.
Had no idea PHP has cheat codes like this
It shouldn't work with floats. If floats ar needed return must be changed from int to float
This won't work with floats..
I can't get it:
//1..9 = (9 * 1) = 9
//10..99 = (100 * 2) = 200
//100..999 = (1_000 * 3) = 3_000
//1000..9999 = (10_000 * 4) = 40_000
//10_000..99_999 = (100_000 * 5) = 500_000
//100_000..999_999 = (1_000_000 * 4) = 6_000_000
//1_000_000..9_999_999 = (10_000_000 * 7) = 70_000_000
//10_000_000..36_123_011 = (26123011 * 8) = 208_984_088
//sum: 208_984_088 + 70_000_000 + 6_000_000 + 500_000 + 40_000 + 3_000 + 200 + 9 = 285_527_297
//And solution is telling 277_872_985
What am I doing wrong?
it is great solution!
man i should use google
If you have set declare(strict_types=1); php would throw an error (because you try to return string as int), if this declaration is missing it will convert string to int.
This comment is hidden because it contains spoiler information about the solution
Nonone should use PHP <8.0 in 2022 ;)
Ugh. I way overthought this one.
Nice solution, however I would like to note it only works on PHP 8.0
Nice quick solution, but slow on large numbers. :)
Duplicate.
I've changed assert types, should be fine now, thanks
Expected and actual values in test message are flipped.
Loading more items...