题解 | #牛牛的唯一元素计数#

牛牛的唯一元素计数

https://www.nowcoder.com/practice/0d972fa370e043ea96018fd43fa4a1fe

class Solution {
public:
    /**
     * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
     *
     * 
     * @param nums int整型vector 
     * @return int整型
     */
    int countUniqueElements(vector<int>& nums) {
        // write code here
        set<int> myset;
        for(int item:nums){
            myset.insert(item);
        }
        return myset.size();
    }
};

全部评论

相关推荐

点赞 评论 收藏
分享
后来123321:别着急,我学院本大二,投了1100份,两个面试,其中一个还是我去线下招聘会投的简历,有时候这东西也得看运气
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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