public class Solution {
public int[] searchRange(int[] nums, int target) {
int s = find(nums, target);
if(s == nums.length || nums[s] != target) {
return new int[]{-1, -1};
}
int e = find(nums, target + 1) - 1;
if(e == nums.length || nums[e] != target) {
return new int[]{-1, -1};
}
return new int[]{s, e};
}
private int find(int[] nums, int target){
int s = 0, e = nums.length;
while(s < e){
int m = (s + e) / 2;
if(nums[m] >= target) {
e = m;
} else {
s = m + 1;
}
}
return s;
}
}
ERROR
Error: Main method not found in class Solution, please define the main method as:
public static void main(String[] args)
or a JavaFX application class must extend javafx.application.Application