Pregunta de entrevista de Lenovo

Backtracking and Greedy algorithm leetcode question.