GamifiedGamified challengesPracticeRaceLeaderboardPricing

Learn data structures by watching them move, then doing it yourself. Press M anytime to toggle sound.

A product of Amypo Technologies, Coimbatore.

Learn

  • Fundamentals & OOPs
  • Data structures and algorithms
  • Aptitude
  • Learning path
  • How it works
  • About dotprep

Practice

  • Practice arena
  • Daily challenge
  • Gamified challenges
  • Race mode
  • Leaderboard

Interview prep

  • Java interview
  • Coding questions
  • Company questions
  • System design
  • Jobs & careers

You

  • Dashboard
  • Settings
  • Pricing
  • Create account

© 2026 dotprep

Content last updated 27 November 2026

GamifiedGamified challengesPracticeRaceLeaderboardPricing
AptitudeQuantitative aptitude · Time, Speed and Work

Problems on Trains

Treat a train as a moving length: crossing poles, platforms, bridges, walkers and other trains with the right distance and the right relative speed.

5 min read 45 questions
Practice questions

On this page

1/9
  1. 011. A train is a moving length
  2. 022. Core formulas
  3. 033. Poles, platforms, bridges and tunnels
  4. 044. People who are walking
  5. 055. Two trains
  6. 066. Two conditions, two unknowns
  7. 077. Common traps
  8. 088. Revision sheet
  9. 09Practice
Back to top

1. A train is a moving length

Train questions are ordinary speed-distance-time questions with one twist: the train is not a point. "Crossing" something starts when the engine reaches it and ends when the last coach leaves it, so the distance covered always includes the train's own length.

Train: 200 m72 km/hPlatform: 300 m
To clear the platform, the engine must travel 300 m and then a further 200 m so that the last coach is clear: 500 m in all.

Two habits solve most of this chapter. First, write down the distance as "length of train + length of the thing crossed". Second, convert the speed to m/s before dividing, because lengths are in metres and times in seconds.

2. Core formulas

The train crosses…DistanceSpeed to use
a pole, signal or standing personLtrain speed
a platform, bridge or tunnel of length PL + Ptrain speed
a person moving the same way at uLv − u
a person moving towards it at uLv + u
another train, opposite directionL1 + L2v1 + v2
another train, same directionL1 + L2v1 − v2
a passenger sitting in another trainlength of the train being watchedv1 ± v2

km/h × 5/18 = m/s. Learn the common ones: 36 → 10, 54 → 15, 72 → 20, 90 → 25, 108 → 30 m/s.

3. Poles, platforms, bridges and tunnels

Pole. A 200 m train at 72 km/h (20 m/s) passes a pole in 200 ÷ 20 = 10 s: it only has to move its own length.

Platform or bridge. The same train crosses a 300 m platform in (200 + 300) ÷ 20 = 25 s. Bridges and tunnels are platforms by another name.

Working backwards. If a train passes a pole in 10 s and a 300 m platform in 25 s, the extra 15 s is spent on the extra 300 m, so its speed is 300 ÷ 15 = 20 m/s (72 km/h) and its length is 20 × 10 = 200 m. Two crossings of different lengths always give the speed by subtraction.

Completely inside a tunnel. A 200 m train in a 700 m tunnel at 90 km/h is fully hidden only while the engine travels 700 − 200 = 500 m: 20 s. Clearing the tunnel needs 700 + 200 = 900 m: 36 s. Read which of the two is asked.

4. People who are walking

A person has no length worth counting, but if the person moves, use the relative speed: the rate at which the train gains on, or closes with, the person.

Train: 150 m63 km/h9 km/hJogger
Same direction: the train gains on the jogger at 63 − 9 = 54 km/h.

A 150 m train at 63 km/h passes a jogger doing 9 km/h in the same direction in 150 ÷ 15 = 10 s, because the relative speed is 54 km/h = 15 m/s. If the jogger runs towards the train, the relative speed is 72 km/h = 20 m/s and the time drops to 7 1/2 s.

Subtract or add the speeds while they are still in km/h, then convert the result once.

5. Two trains

When two trains pass, the distance is the sum of both lengths, whatever the direction. Only the relative speed changes: sum of speeds for opposite directions, difference for the same direction.

Train A: 250 m72 km/hTrain B: 170 m54 km/h
Opposite directions: 420 m to cover at 72 + 54 = 126 km/h.

Opposite directions. Relative speed 126 km/h = 35 m/s; time = 420 ÷ 35 = 12 s.

Same direction. Relative speed 18 km/h = 5 m/s; time = 420 ÷ 5 = 84 s. Overtaking takes far longer than crossing.

A passenger in one train is a point. The time another train takes to pass that passenger depends only on the other train's length, not on the length of the train the passenger is sitting in.

6. Two conditions, two unknowns

Harder questions give two crossings and ask for a length or speed that appears in both. Write one line per crossing and subtract or compare.

  • Same train, two walkers. The length is the same: (v − u1) × t1 = (v − u2) × t2. Solve for v in km/h, then get the length.
  • One walker each way at speed u. (v − u) × t1 = (v + u) × t2 gives v = u × (t1 + t2) ÷ (t1 − t2).
  • Two trains, both directions. Total length ÷ crossing time gives v1 + v2; total length ÷ overtaking time gives v1 − v2. If those come to 60 and 12 km/h, the trains run at 36 and 24 km/h (half-sum and half-difference).
  • Only the times are given. (v1 + v2) : (v1 − v2) = overtaking time : crossing time, so v1 : v2 = (sum of the times) : (difference of the times).

7. Common traps

  • Forgetting the train's own length when it crosses a platform or bridge.
  • Dividing metres by km/h. Convert to m/s first (× 5/18).
  • Adding a person's "length". For a pole or person the distance is just L.
  • Using the train's full speed against a walker. Use v − u or v + u.
  • Using the full speed against a fixed platform after finding the length from a walker. The platform does not move: go back to v.
  • Counting the passenger's own train. Only the length of the train that is seen passing matters.
  • Distance gained versus distance travelled. While overtaking, a train gains L1 + L2 on the other but travels much further over the ground.

8. Revision sheet

  • Time = distance ÷ speed, with distance in m and speed in m/s.
  • Pole or person: L. Platform, bridge, tunnel: L + P. Two trains: L1 + L2.
  • Fully inside a tunnel: tunnel − train.
  • Same direction: subtract speeds. Opposite: add speeds.
  • Pole in t1, platform P in t2 → speed = P ÷ (t2 − t1), length = speed × t1.
  • Sum and difference of two speeds → the speeds are the half-sum and half-difference.
  • 36, 54, 72, 90, 108 km/h = 10, 15, 20, 25, 30 m/s.

Practice

45 questions in 3 sets. Every answer comes with its explanation, and each question you get right earns XP.

  • Easy · 15
  • Medium · 15
  • Hard · 15
Start practising
PreviousTime, Speed and DistanceNextPipes and Cisterns
Log inStart free