Amazon interview question

Can't remember but it's Leetcode's medium difficult question