General Motors (GM) interview question

Coding challenge. Was two coding challenge problem leetcode ez