TLE- pivot of sorted and rotated array

my code is running fine but is showing TLE in both test cases upon submission, please check my code