TUQ interview question

To solve a leetcode question