/*Time complexity: (Ologn)
  Space complexity : O(1)
*/
class Solution {
    public int search(int[] nums, int target) {
        int l = 0;
        int r = nums.length;
        while (l < r)  {
            int m = l + (r - l) / 2;
            if (nums[m] == target) {
                return m;
            } else if (nums[m] > target) {
                r = m;
            } else {
                l = m + 1;
            }
        }
        return -1;
    }
}

@@ -16,10 +16,10 @@
 ty: 
-(
 O
+(
 logn
@@ -183,17 +183,16 @@
  (l %3C r)
- 
  %7B%0A     

refresh BinarySearch.java