Solve three easy algorithm problems | Apple Interview Question