Amazon Interview Question

I forget the question but it seems same one in leetcode