Ants falling off a rod
Asked at Jane Street, Optiver, SIG
Several ants are placed on a 1-meter rod. Each ant walks at 1 meter per minute, some heading left, some right. When two ants collide, they both instantly reverse direction. When an ant reaches either end of the rod, it falls off.
What is the longest possible time until all ants have fallen off the rod, regardless of how many ants there are or where they start?
Show a hint
When two identical ants collide and reverse, what does the scene look like if you couldn't tell the ants apart?