JAVA Binary search with little twist
Intuition\nBy O(logn) we know it is only possible via binary search.\n\n# Approach\nIt is quite similar to - https://leetcode.com/problems/search-in-rotated-sor
# Intuition\nBy $$O(logn)$$ we know it is only possible via binary search.\n\n# Approach\nIt is quite similar to - https://leetcode.com/problems/search-in-rotated-sorted-array/solutions/1566310/simple-java-solution-with-explaination-0-ms-binary-search-logn/?envType=study-plan&id=algorithm-ii&orderBy=most_votes\n\nIn binary search check-> if right boundary element is greater than mid. in such case mid could be the answeer or elements to the left of mid could be the answer. but we are sure right elements will be greater. hence do \nr=m\nelse do l=m+1\n\n\n\n# Complexity\n- Time complexity:\n $$O(logn)$$ \n\n- Space complexity:\n$$O(1)$$\n\n# Code\n```\nclass Solution {\n    public int findMin(int[] nums) {\n\t\tint l = 0;\n\t\tint r = nums.length - 1;\n\t\tint m;\n\t\twhile (l < r) {\n\t\t\tm = (l + r) / 2;\n\t\t\tif (nums[m] < nums[r]) {\n\t\t\t\tr=m;\n\t\t\t} else {\n\t\t\t\tl=m+1;\n\t\t\t}\n\t\t}\n\t\treturn nums[l];\n\t}\n}\n```
['Binary Search', 'Java']