Maximum subtonic array

Please check my code and tell why it shows TLE for last 2 test cases

@anindya-gupta correct the array size as n<=1000000,
rest code is fine!