I understood problem, but stuck at one of the testcase that i drawn:
For e.g. chefs in the queue are [2,2,1,1], in this case should consider junior for 2 at index 2 or at 3 (0-based indexing).
If i consider at 1 at index 2, then answer will be 32= 6
considering at index 3, then answer will be 43= 12
or i should consider any junior with each senior?