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.
Different conditions = different Problem. Instead of writing here, which works fine with the kata conditions, it would be better if you post in some of those other solutions saying "it works for more than 8 digits too". Cheers.
That is not an excuse :) Other solutions work fine even going past the 8 digit "limit".
"parsing" each command evey time is not efficient, and the test code do this a lot when jumping between lines.
"... for an observed PIN with a length of 1 to 8 digits"
This naive solution of mine (checking only rows) https://www.codewars.com/kata/reviews/599ac698a48343e7b90027e1/groups/63ab134c94973c0001c7aba0
passes all tests. This should not happen.
this is naive solution checking only rows, yet all tests from this kata passes. Poor kata.
Thanks for mentioning that.
This has to do with trying to read entries that do not exist. (Looking for the button above a button on the most upper row of buttons does not make sence right??)
I did not encounter this problem at the time I submitted this, as this was allowed by PHP and would result in a 'null' value (hence the check if the result is not null).
Replacing the checks with a more PHP-friendly way should do the trick, so line 8 would be:
if($j > 0) $vals[] = $notepad[$i][$j-1]
This is less pretty and satisfying to look at, but oh well...
ugly code but it's fast :)
for 10 digit string this gives Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /workspace/default/_solution.php on line 20
for 10 digit string this gives Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 67108872 bytes) in /workspace/default/_solution.php on line 11
Failed asserting that two arrays are identical.
(strings vs integers in array)
with PHP8 you get Undefined array key -1 (line 8)
try
getPINs('0123456789')
with this soultion you getFatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /workspace/default/_solution.php on line 34
so it's bad solution performance wise.
You don't need two iterations.
oh, yes
Loading more items...