Circular tracks

Marketing Innovation

Keep up to date on the latest announcements, events, and happenings from the connectivity community.

Circular tracks

Marketing Innovation

Part 1:

There is a circular track with n gas stations around it; the total amount of gas at the stations is exactly enough for you to drive around the track once.

Is it guaranteed that there is a gas station so that, starting from that gas station with an empty tank and driving in some direction, you can make it all the way around the track?

Part 2:

You are on a circular track with n signs, each with an integer label (not necessarily positive!) so that the sum of the labels is (n – 1).

Is there always a place to start walking (in either direction) so that, if you sum up the numbers you see as you walk, your running total never reaches the number of signs you’ve seen?

For example, if the track has the signs 1, 1, 0, I can start at the 0, and my sums will be 0, 0 + 1, and 0 + 1 + 1.

Did you love challenges? Then you will love LiveRamp. Apply now to join our team.