Nordstrom Interview Question

Vo: leetcode 279, very easy