Amazon Interview Question

They gave me two algorithm problems.