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.
Because sorting the array once is slower than iterating through it twice.
Why not sort the array once and then take the last and first elements?
That's certainly an interesting existential quandary.
So in what kind of universe can you occupy a place among "p" number of people where you can have more than "p" number of people standing before you?
If such universe indeed exists, "should" we denote such circumstance as having zero number of people before you? I mean, should it even matter what we call anything at that point?
But you are right.
Use of uint might have been more appropriate.
if (p-bef < 0)
then the result should be 0
This comment is hidden because it contains spoiler information about the solution
sort is much slower than simply iterating over the array once.
This comment is hidden because it contains spoiler information about the solution
This solution enumerates parsed array twice. Not very nice...