Meta interview question

Round 1 coding interview: 2 leetcode easy