难度 简单
题目 Leetcode:
剑指Offer 53 - Ⅰ. 在排序数组中查找数字
统计一个数字在排序数组中出现的次数。
0 <= array.length() <= 50000
题目解析:
懒得解析了,直接map记录,直接输出
以下为参考代码
class Solution { public: int search(vector<int>& nums, int target) { unordered_map<int,int>a; for(int i:nums)a[i]++; return a[target]; } };
原文:https://www.cnblogs.com/lovetianyi/p/15018540.html