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.
The solution is optimal cause solution is always O(n) cause you have to iterate the whole array in every case for checking each value if it is string or int.
This solutions is actually better than type checking each value cause the 'int' function already does a type check, in the case the argument is an int, it just return itself whithout doing any operation.
Actually your solution is worse cause you are doing 2 type checkings instead of one, you are using try/catch in a loop wich is terrible slow, you are usign an extra array that consumes more memory which is not necesary, you are iterating the extra array making '2n + C' operations instead the 'n + C' from the best solution...
Would you please give example entrie that are not in the test?
This comment is hidden because it contains spoiler information about the solution
Print the input (the first string is what your function returned), it's a problem with your code. From those strings it seems you're grabbing the first number of the string, removing all numbers of it, adding 1 to the number you grabbed it and appending that to the end.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution