Meta interview question

Standard coding DSA question from Leetcode