Pregunta de entrevista de Amazon

Leetcode Balloon and arrow question