mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-08 16:18:46 +00:00
67. 数字在排序数组中出现的次数
https://www.acwing.com/problem/content/submission/code_detail/7757066/
This commit is contained in:
parent
9adc6d8bb7
commit
32a72cdeb4
10
AcWing/67/67.cpp
Normal file
10
AcWing/67/67.cpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
class Solution {
|
||||||
|
public:
|
||||||
|
int getNumberOfK(vector<int>& nums, int k) {
|
||||||
|
int ans = 0;
|
||||||
|
for (int i : nums) {
|
||||||
|
ans += i == k;
|
||||||
|
}
|
||||||
|
return ans;
|
||||||
|
}
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user