24
遍历和lower_bound//返回大于等于的
#include <iostream>
#include <algorithm>
#include <vector>
class Solution {
public:
int getNumberOfK(vector<int>& nums , int k) {
// auto l = lower_bound(nums.begin(), nums.end(), k);
// auto r = upper_bound(nums.begin(), nums.end(), k);
// return r - l;
int c;
for(auto s:nums)if(k==s)c++;
return c;
}
};