[Java/C++/Python] Pow of 2
Intuition\nIf 1 not in A, we return 1.\nIf 2 not in A, we return 2.\n\n\n# Explanation\nIf 1 not in A,\nwe return 1,\notherwise we can have x = 1.\n\nIf 2 not i
# **Intuition**\nIf 1 not in A, we return 1.\nIf 2 not in A, we return 2.\n<br>\n\n# **Explanation**\nIf 1 not in `A`,\nwe return 1,\notherwise we can have x = 1.\n\nIf 2 not in `A`,\nwe return 2.\notherwise we can have x = 2.\n\nSince we can have x = 1 and x = 2,\nthen we can have x = 1 | 2 = 3.\n\nIf 4 not in `A`,\nwe return 4,\notherwise we have x = 4\n\nSince we can have x = 1 and x = 4, then we can have x = 1 | 4 = 5.\nSince we can have x = 2 and x = 4, then we can have x = 2 | 4 = 6.\nSince we can have x = 1,2,4, then we can have x = 1 | 2 | 4 = 7.\n\nSo we can find the rule here,\nfind out the minimum pow of 2,\nwhich is not in `A`.\n\nThe process of prove is same as above.\n<br>\n\n# **Complexity**\nTime `O(32n)`\nSpace `O(32n)`\n<br>\n\n**Java**\n```java\n    public int minImpossibleOR(int[] A) {\n        Set<Integer> s = new HashSet<>();\n        for (int a : A)\n            s.add(a);\n        int a = 1;\n        while (s.contains(a))\n            a <<= 1;\n        return a;\n    }\n```\n\n**C++**\n```cpp\n    int minImpossibleOR(vector<int>& A) {\n        unordered_set<int> s(A.begin(), A.end());\n        int a = 1;\n        while (s.count(a))\n            a <<= 1;\n        return a;\n    }\n```\n\n**Python**\n```py\n    def minImpossibleOR(self, A):\n        A = set(A)\n        return next(1 << i for i in range(32) if (1 << i) not in A)\n```\n
['C', 'Python', 'Java']