LinkedIn interview question

It's on leetcode