For the binary search solution (), the binary search algorithm is not working finding the first and the last numbers. I propose this approach. `public static int findTarget(int[] arr, int target) { if (arr.length == 0) return -1; int start = 0, end = arr.length; while (start<=end) { int mid = (start+end)/2; if(arr[mid]==target) return mid; else if(arr[mid]<target){ start=mid+1; } else { end=mid-1; } } return -1; }`
For the binary search solution (), the binary search algorithm is not working finding the first and the last numbers.
I propose this approach.
`public static int findTarget(int[] arr, int target) {
if (arr.length == 0) return -1;