Domanda di colloquio di Canva

A back-tracking algorithm problem, medium difficulty on LeetCode