• Logic Lounge
  • Posts
  • Traffic Lights: The Fastest Route to the Candy Store

Traffic Lights: The Fastest Route to the Candy Store

Dr. Rational is HUNGRY

Good evening.

Per popular request, I’ve changed the format of my newsletter. I will now post weekly on Tuesdays at 5 pm PST. Submissions will close when the next problem is posted.

This week’s problem is inspired by a classic conundrum in urban cities. Here it is:

Backstory: Dr. Rational goes to his local candy shop every morning. He needs to cross to the opposite corner of the street. Usually, he presses both buttons. He wants to know if this is optimal, so that he can buy candy faster.

Problem: Dr. Rational starts at the corner marked “START”. Assume that only one crosswalk can be active at a time, and each crosswalk is active for 10 seconds. Should Dr. Rational press both Button A and Button B, or just Button A?

Hint: Weighted Graph

When you solve the above problem, please email your solution as a boolean to [email protected] to be mentioned on our GitHub leaderboard. Submissions close 2/18 at 4:59 pm PST.

That's all, folks!

Angad Singh