Brainteasers

Ants on a Stick

NeetQuant · August 2026 · 3 min read

The problem

100 ants are placed on a 1-metre stick at arbitrary positions, each facing left or right, all walking at 1 metre per minute. When two ants meet they instantly reverse direction. An ant falls off at either end. What is the longest possible time before all ants have fallen off?

The reframe

Two identical ants colliding and reversing looks exactly the same as two ants walking through each other, if you do not track which ant is which.

Since the ants are identical, nothing observable distinguishes the two interpretations. So ignore the collisions entirely.

The answer

With collisions ignored, each ant simply walks in a straight line at 1 m/min until it falls off. The longest any single ant can take is the full length of the stick - an ant at one end walking toward the other.

Maximum time: 1 minute.

Independent of the number of ants, and of their arrangement.

Why this is a good question

The direct approach is a nightmare - tracking 100 ants through an unknown number of collisions, each changing subsequent collisions. Candidates who start down that path do not finish.

The question tests whether you look for a change of representation before grinding. That is the same instinct that finds symmetry arguments and that turns hard counting problems into indicator sums.

The follow-up

"Which ant falls off last?"

Here the reframe needs care. The set of positions over time is the same in both interpretations, but the identities are not - in the pass-through picture the labels travel differently.

Since ants cannot pass each other in reality, their left-to-right order is preserved. So if k ants fall off the left end, the ant that falls off last is determined by matching sorted positions to sorted exit times. It is a permutation-tracking exercise on top of the simple answer.

Interviewers use this follow-up to check you understood the trick rather than repeated it.

More in brainteasers.

Keep practising

Practise quant interview questions free

Create a free account to attempt hundreds of questions with hints and answer checking, and to run the timed simulators.

Start practising free

Frequently asked questions

How long until all the ants fall off the stick?
At most the time to walk the full length - 1 minute for a 1-metre stick at 1 m/min. Colliding ants that reverse are indistinguishable from ants passing through each other, so the collisions can be ignored entirely.