Pinterest interview question

Leetcode recursion question for strings