i was getting TLE for the last three test cases(on hackerrank) for this submision
so what i did was to use the two pointer theorem to iterate over the array thus decreasing its time complexity
but i am getting a TLE on the first test case itself please help me out to solve this problem using the two pointer algorithm