LeetCode #2206

Divide Array Into Equal Pairs

1개의 풀이 · C++

문제 원문 보기 ↗

SOLUTION INFO

C++ · main.cpp

main.cpp
class Solution {
public:
    bool divideArray(vector<int>& nums) {
        int N = (int)nums.size();
        vector<int> cnt(501);
        for(const int &x: nums) ++ cnt[x];
        for(int i = 1; i <= 500; ++i) {
            if(cnt[i] % 2 != 0) return false;
        }
        return true;
    }
};

SOLUTION DESCRIPTION

풀이 설명

등록된 풀이 설명이 없습니다.