Nothing here yet.
Nothing here yet.
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)
Hello Sumanth, Thanks for reaching out .As I am in learning stage I don't have much expertise to suggest .But I can tell one thing which I am following, if you want to learn anything not only java there are many websites which provides documentation .If you have time ,start reading oracle documentation for java ,it gives you good amount of information and there by start solving problems then the journey continues "If you are clear with the destination you will some how find the way" Providing the list of links below for Java ,You can follow any thing which suits you because the thing worked for me may not work for you. https://www.geeksforgeeks.org/java/ 2.https://www.youtube.com/watch?v=BGTx91t8q50 3.https://docs.oracle.com/javase/tutorial/java/concepts/index.html