Tyroo Media Interview Question

3 ball problem for the coding round