General Motors (GM) Interview Question

Coding challenge. Was two coding challenge problem leetcode ez