题解 | #农场牛的标识II#

农场牛的标识II

https://www.nowcoder.com/practice/a69dc54eeffa43218d06f62cc733c6c0

class Solution {
public:
    /**
     * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
     *
     * 
     * @param nums int整型vector 
     * @return int整型
     */
    int singleNumberII(vector<int>& nums) {
        // write code here
        map<int, int> map;
        for (auto& x : nums)
            map[x]++;
        for (auto& x : map)
            if (x.second == 1)
                return x.first;
        return 0;
    }
};

全部评论

相关推荐

10-28 10:48
已编辑
门头沟学院 Java
孩子我想要offer:发笔试后还没笔试把我挂了,然后邮箱一直让我测评没测,后面不知道干嘛又给我捞起来下轮笔试,做完测评笔试又挂了😅
点赞 评论 收藏
分享
投递三奇智元机器人科技有限公司等公司10个岗位
点赞 评论 收藏
分享
评论
1
1
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务