Meta interview question

a recursive problem in js