General Motors (GM) Interview Question

- What was your thought process behind the code?