TikTok interview question

LC recursion, if / else