I can't solve this question (popping balloons)


Popping balloons from codejam.