(int[] nums, int target)
| 1 | class Solution { |
| 2 | public int[] searchRange(int[] nums, int target) { |
| 3 | |
| 4 | // define array for storing output |
| 5 | int arr[] = new int[2]; |
| 6 | // initialize with -1 |
| 7 | Arrays.fill(arr,-1); |
| 8 | |
| 9 | // border case |
| 10 | if(nums==null || nums.length==0) return arr; |
| 11 | arr[0] = search(nums,target,true); |
| 12 | arr[1] = search(nums,target,false); |
| 13 | return arr; |
| 14 | } |
| 15 | |
| 16 | int search(int nums[],int target, boolean isFirst) |
| 17 | { |