Skip to content

Instantly share code, notes, and snippets.

View coderAadmi's full-sized avatar
🎯
Focusing

Pradyumn Kumar Upadhyay coderAadmi

🎯
Focusing
  • Delhi
View GitHub Profile
@jlacar
jlacar / google-foobar-gearingup-solved.md
Last active April 9, 2023 19:53
Math for solution to Google foo.bar challenge - Gearing Up for Destruction

This is about the Google foo.bar Gearing Up for Destruction challenge - 2nd of 2 challenges on Level 2. It was pretty interesting and I got through most of it without looking for answers. I did get stuck on 2 failing tests so I finally caved. I didn't copy my solution though, just got an insight from the solution that @CBarraford posted here: https://gist.github.com/1lann/be45311db1bd8cbbe6650b0a3e9d1977, which was a more brute-force trial-and-error solution.

Here's the math I worked out for this problem:

Given: 
   n pegs, numbered from 1 to n

Let:
   d(n) - the distance between peg[n] and peg[n+1]