Goldman Sachs interview question

do a leetcode styled reurrsion question