Question d’entretien chez Amazon

Leetcode hard question, about different algorithms