自己写的:
class Solution {
public:
/**
* 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
*
*
* @param nums int整型vector
* @return int整型
*/
int minNumberDisappeared(vector<int>& nums) {
// write code here
unordered_map<int,int> hash;
for(int i = 0; i< nums.size(); i++){
hash[nums[i]]++;
}
int res = 1;
while(hash.count(res) == 1){
res ++;
}
return res;
}
};
模板的:
一样。