Amazon interview question

Leetcode questions on hackerrank platform