Meta interview question

Leetcode 239 and 756, 455