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.
sorry can you explain what did you do before substr
If the input array is reverse sorted, I think this solution would fail.
If the input array were
{ 1000, 999, 998, 997 }
, onlylowone
would ever be assigned.(Unless I'm missing something?)
This comment is hidden because it contains spoiler information about the solution
My dumbass forgot that substr existed, and I went with indexing and concatenating after deep copying. I thought that'd be a performance drain but actually it's very well optimised and it came to ~0.1ms faster than substringing; was quite interesting.
you could also use a switch statement instead of those ifs
This comment is hidden because it contains spoiler information about the solution
oh my goodness gracious
he go through all values untill a square root of num as i inderstand
php much
I had a very similar solution, though yours looks a bit more memory effective than mine. This fails case-sensitivity though ;) (even if it wasnt a rule.)
I did the same thing with a switch, I like how he extruded the comparator to its own function. I didn't even think to just use a char array for memory then convert back to a string with the return line. I used a string array. (I also haven't coded in years xD) Very elegant!
concize, but hard to understand, so it's clever as well as it's not a best practice
SORT BY: "Most Verbose"
This comment is hidden because it contains spoiler information about the solution
I did this but added strings to a knew string. This is more efficient
Loading more items...