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.
I submitted the solution above and one slightly refactored variation 9 years ago. I definitely did not copy from StackOverflow and I claim my solution original. I have no idea how a number of people came up with the exact solution of mine. Note that you can see other solutions once you solved a kata. Interestingly many of the accounts above where suspended.
solutions were copy pasted from the internet (stackoverflow) probably.
1st and nth chair are the first and second chairs to be occupied and can be removed from the picture.
Condition 1: (n-1)th chair is the lowest possible distance from the nth chair.
All chairs with a higher distance from another occupied chair will be taken first.
Condition 2: (n-1)th chair has the highest distance from the exit.
When all chairs have the same distance from another occupied chair, the chairs closer to the exit will be taken first.
Last remaining chair is the (n-1)th chair.
If you still have trouble understanding this, try to break this expression down into the smallest pieces and do each one separately, then you will see what they all do together.
A little hint: each character is an operator that is perfectly documented.
It can be a much bigger problem to understand why this expression solves the problem in this task.
Thank you. It's my first kata ever
Edited.
Why did you raise an issue? shouldn't it be a suggestion?
This comment is hidden because it contains spoiler information about the solution
yes
This comment is hidden because it contains spoiler information about the solution
code golfing... ;)