Amazon interview question

combinatorics programming question using recursion