Apple interview question

Leetcode q - forgot the exact one