看见有序其实可以考虑二分法···但是这题···这样多好啊
class Solution {
public:
int GetNumberOfK(vector<int> data ,int k) {
int count = 0;
int length = data.size();
for ( int i = 0; i != length; i++)
{
if (data[i] == k)
{
count++;
}
}
return count;
}
};