Skip to content

Instantly share code, notes, and snippets.

@w3cj
Forked from bertoort/robot-and-batteries.md
Created April 18, 2017 14:39
Show Gist options
  • Save w3cj/c8e9a2297784467e7b8e28799da10523 to your computer and use it in GitHub Desktop.
Save w3cj/c8e9a2297784467e7b8e28799da10523 to your computer and use it in GitHub Desktop.
Brain Teaser Warm-Up

Problem

A robotic technology startup is located in San Francisco. The CEO has 3000 battery packs that he wants to transport with Danny (the robotic bird) to his other branch, across a 1000-kilometer stretch of land. The owner has only one robotic bird, which carries a maximum of 1000 battery packs at any moment in time, and consumes one battery pack every kilometer it travels.

Question

What is the largest number of battery packs that can be delivered to the branch?

@willmeierart
Copy link

(3x) 1000 >> 250 (leave 500@) 1500 each trip + 250 from final >> 1750@250
(1x) 1000>>500 (500@500), return pick up 750 from 250mark, gets to 500 with 500 left, pick up 5 from 5mark, all the way w full thousand leaves 500

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment