1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-02-05 07:00:25 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/统计目标成绩的出现次数 [zai-pai-xu-shu-zu-zhong-cha-zhao-shu-zi-lcof].html

33 lines
1.1 KiB
HTML
Raw Normal View History

2023-12-09 18:53:53 +08:00
<p>某班级考试成绩按非严格递增顺序记录于整数数组 <code>scores</code>,请返回目标成绩 <code>target</code> 的出现次数。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong> scores = [2, 2, 3, 4, 4, 4, 5, 6, 6, 8], target = 4
<strong>输出:</strong> 3</pre>
<p><strong>示例&nbsp;2</strong></p>
<pre>
<strong>输入:</strong> scores = [1, 2, 3, 5, 7, 9], target = 6
<strong>输出:</strong> 0</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>0 &lt;= scores.length &lt;= 10<sup>5</sup></code></li>
<li><code>-10<sup>9</sup>&nbsp;&lt;= scores[i]&nbsp;&lt;= 10<sup>9</sup></code></li>
<li><code>scores</code>&nbsp;是一个非递减数组</li>
<li><code>-10<sup>9</sup>&nbsp;&lt;= target&nbsp;&lt;= 10<sup>9</sup></code></li>
</ul>
<p>&nbsp;</p>
<p><strong>注意:</strong>本题与主站 34 题相同(仅返回值不同):<a href="https://leetcode-cn.com/problems/find-first-and-last-position-of-element-in-sorted-array/">https://leetcode-cn.com/problems/find-first-and-last-position-of-element-in-sorted-array/</a></p>
<p>&nbsp;</p>