Pregunta de entrevista de General Motors (GM)

Coding challenge. Was two coding challenge problem leetcode ez