General Motors (GM) interview question

Basic algorithms for coding challenge