Fibbonaci Steps
Goldman Sachs
You are to cover a distance od 100m and can make steps of either 1m or 2m. In how many different ways (combinations of 1m and 2m steps) can you cross the 100m?
Answer
When you have a problem asking you about an experiment with a large number (e.g. 100 steps, something infeasible to count manually), you need to first understand the dynamic at a lower level. This time, we'll start at the end, as it's easier to gradp the dynamic. So let's focus on the last step: it can either be a 1m step or a 2m step. That's it - two options. In case it was a 1m step, then before that we were at 99m mark, and there's a number of ways we could have reached this 99m mark. Call this $f(99)$, where $f(x)$ function measures the number of steps to cross x meters. Other option is that last step was a 2m step, in which case we were at 98m mark before, and there are further $f(98)$ ways to have reached the 98 mark.
Now notice we are counting possibilities, so both of these will add up: last step was either a 1m - which leads to further $f(99)$ possibilities; or it was a 2m - which leads to further $f(98)$ steps. Therefore, we conclude: $$f(100)=f(99)+f(98)$$Now we can apply this same logic to 98 and 99, i.e. $$f(99)=f(98)+f(97)$$ $$f(98)=f(97)+f(96)$$Now we have a recursive relationship, where we can explain the number of ways to reach any distance in terms of previous two distances. If we know two to start with, we can work our way all the way to 100m.
We know some trivial cases already: there's only one way to cross a 1m distance ($f(1)=1$), and two ways to cross a 2m distance (either with two 1m steps or one 2m step, i.e. $f(2)=2)$). There we go, now we have the starting two sequences and we can obtain each subsequent count using the previous two. This also happens to be the definition of Fibbonaci numbers: you start at 1 and 2 and each next number is the sum of previous two: 1, 2, 3, 5, 8, 13, 21 etc. So our solution is effectively the 100th Fibbonacci number! No need to take it further in an interview scenario (unless they want you to code it), so this suffices as the answer.