Pregunta de entrevista de TuSimple

basically leet code problem no resume question.