Optiver·Data Scientist·Technical Phone Screen
- You have two non-empty piles of stones with sizes a and b. Each move, you double the smaller pile by transferring that many stones from the larger one. Determine whether this process will eventually empty one of the piles, or cycle forever. Your solution must run in logarithmic time.
“My first instinct was just to simulate it and slap a visited-states check on top.”