Amazon Interview Question

all from data structures & algorithm