Amazon coding challenge