leetcode算法题--数组中数字出现的次数 II

    科技2022-07-12  131

    原题链接:https://leetcode-cn.com/problems/shu-zu-zhong-shu-zi-chu-xian-de-ci-shu-ii-lcof/

    int singleNumber(vector<int>& nums) { int ones = 0, twos = 0; for (int num : nums) { ones = ones ^ num & ~twos; twos = twos ^ num & ~ones; } return ones; }
    Processed: 0.009, SQL: 8