Spotify interview question

Basic recursion algorithms and code interview