TriNet interview question

Basic DSA on recursion and Map on JS