Solve stock and banana problems | Apple Interview Question