Please post the solution

Please post the code for this problem as the code given in the solution is not passing any test case.

@jayasmit98
the problem in the editorial was that the temp array size was just 10000.
I have attached the correct code…