Amazon interview question

2 LP questions 1 leetcode medium