Thanks for commenting 😁 & giving another possibility to solve the problem.
If I understood correctly ,The approach you described involves dividing the array and checking the last element of the left subarray to determine if there are positive numbers in that subarray. If the last element is positive, the algorithm recursively searches that subarray. Otherwise, it searches the right subarray.
I don't think there will be variation in time complexity since sorting involves in the suggested approach also.
But will definitely try the approach mentioned via code and get back.
Actually the first approach taken is to solve the problem mainly. Then after I have focused on decreasing complexity in terms of time and space. Unfortunately ended up in bringing difference in only time complexity in second approach i.e., O(n) which is better than first approach with time complexity i.e., O(nlogn)
Kumarasamy Mani
NA
What happens if we use Divide and Conquer after sorting? Will that be efficient, sort it and try to remove all the -Ve elements by dividing the array and checking the last element, if it's null ignore it and continue till you get +ve element in left array's last element, then use index and figure out won't it reduce the time?