Amazon Interview Question

Leetcode Hard Question was asked