package leetcode;

/**
 * https://leetcode.com/problems/binary-search/
 */
public class Problem704 {
    public int search(int[] nums, int target) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem704 prob = new Problem704();
    }
}

@@ -154,82 +154,167 @@
     
-// TODO%0A        return 0
+int left = 0;%0A        int right = nums.length - 1
 ;%0A    
-%7D%0A%0A
     
-public static void main(String%5B%5D args
+while (left %3C= right) %7B%0A            int mid = (left + right) / 2;%0A            if (nums%5Bmid%5D %3C target
 ) %7B%0A
@@ -325,42 +325,200 @@
     
-Problem704 prob = new Problem704()
+        left = mid + 1;%0A            %7D else if (nums%5Bmid%5D %3E target) %7B%0A                right = mid - 1;%0A            %7D else %7B%0A                return mid;%0A            %7D%0A        %7D%0A        return -1
 ;%0A  

Solve problem 704