General Motors (GM) interview question

Coding question done through hirevue