Question d’entretien chez Amazon Robotics

One question in leetcode, mid level difficulty