leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

1460.cpp (333B)


      1 class Solution {
      2   public:
      3     bool canBeEqual(const vector<int> &target, const vector<int> &arr) const {
      4         static int um[1001];
      5 
      6         memset(um, 0x00, sizeof(um));
      7         for (const int n : target)
      8             um[n]++;
      9         for (const int n : arr)
     10             if (!um[n]--) return false;
     11 
     12         return true;
     13     }
     14 };