某班级考试成绩按非严格递增顺序记录于整数数组 scores
,请返回目标成绩 target
的出现次数。
示例 1:
输入: scores = [2, 2, 3, 4, 4, 4, 5, 6, 6, 8], target = 4 输出: 3
示例 2:
输入: scores = [1, 2, 3, 5, 7, 9], target = 6 输出: 0
提示:
0 <= scores.length <= 105
-109 <= scores[i] <= 109
scores
是一个非递减数组-109 <= target <= 109
注意:本题与主站 34 题相同(仅返回值不同):https://leetcode-cn.com/problems/find-first-and-last-position-of-element-in-sorted-array/
1. 请不要在评论区发表题解!
2. 评论区可以发表关于对翻译的建议、对题目的疑问及其延伸讨论。
3. 如果你需要整理题解思路,获得反馈从而进阶提升,可以去题解区进行。
Plus 会员解锁
自定义布局