Car Wheels — Puzzle for Interview rounds

Question :

A car has 4 tyres and 1 spare tyre. Each tyre can travel a maximum distance of 20000 miles before wearing off. What is the maximum distance the car can travel before you are forced to buy a new tyre? You are allowed to change tyres (using the spare tyre) an unlimited number of times.

Solution :

25000 kms.

Divide the lifetime of the spare tire into 4 equal part i.e., 5000 and swap it at each completion of 5000 miles distance.

Let four tyres be named as A, B, C and D and spare tyre be S.

  1. 5000 KMs: Replace A with S. Remaining distances (A, B, C, D, S) : 15000, 15000, 15000, 15000, 20000.
  2. 10000 KMs: Put A back to its original position and replace B with S. Remaining distances (A, B, C, D, S) : 15000, 10000, 10000, 10000, 15000.
  3. 15000 KMs: Put B back to its original position and replace C with S. Remaining distances (A, B, C, D, S) : 10000, 10000, 5000, 5000, 10000.
  4. 20000 KMs: Put C back to its original position and replace D with S. Remaining distances (A, B, C, D, S) : 5000, 5000, 5000, 0, 5000.
  5. 25000 KMs: Every tyre is now worn out completely.

All tyres are used to their full strength.

Thanks for Reading

Placewit grows the best engineers by providing an interactive classroom experience and by helping them develop their skills and get placed in amazing companies.

Learn more at Placewit. Follow us on Instagram and Facebook for daily learning.

--

--

--

Upskilling students for tech placements!

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Making the most of working from home — lessons learnt from Hurricane Sandy

Ask a Recruiter: How Can I Job Search During Coronavirus?

Is 30 Too Old To Work In A StartUp?

Designers: How to get a job at a startup

A Couple Crazy Things That’ve Happened Recently

SWOT Analysis

How’s Your Online Executive Presence?

How Using KPIs Can Increase your Law Firm’s Profitability? | TimeSolv

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Placewit

Placewit

Upskilling students for tech placements!

More from Medium

Scattered Rice Coding Question

LeetCode 253 — Meeting Rooms 2

“Delete and Earn” problem using Dynamic Programming

PlatinumX Tech’s Algorithm Expert Course Review (How I got into Turing).