Handling large test cases

this question of biotonic array and many others having test cases in hundreds and moreover array size in lakhs how to handle these.

Hey I have provided the you the code with explanation to the solution.