leetcode

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

1346.cpp (324B)


      1 class Solution {
      2   public:
      3     bool checkIfExist(vector<int> &arr) {
      4         unordered_set<int> us;
      5         for (int i : arr)
      6             if ((i % 2 == 0 && us.find(i / 2) != us.end()) || us.find(i * 2) != us.end())
      7                 return true;
      8             else
      9                 us.insert(i);
     10 
     11         return false;
     12     }
     13 };