题目
统计一个数字在排序数组中出现的次数。
示例 1:
1 | 输入: nums = [5,7,7,8,8,10], target = 8 |
示例2:
1 | 输入: nums = [5,7,7,8,8,10], target = 6 |
提示:
0 <= nums.length <= 10^5
-10^9 <= nums[i] <= 10^9
nums
是一个非递减数组-10^9 <= target <= 10^9
解法
解法一:
JAVA
1 | public int search(int[] nums, int target) { |