JavaScript solution - beats 100% on memory and speed. No set, avoids sort, only 4 num var allocs
Intuition\nFor every power of two, it can only be expressed by itself. It\'s best to see this from a few examples:\n\n0b001 -> 1 Can only be expressed by itself
# Intuition\nFor every power of two, it can only be expressed by itself. It\'s best to see this from a few examples:\n\n`0b001` -> `1` Can only be expressed by itself.\n`0b010` -> `2` cannot be expressed with any value large since for any two values, `A | B`, `A | B`  will always be greater than or equal to either `A` or `B`. But, since all the values less than 2 (ie., `0b001`) cannot be `OR`\'d to create a new bit for `0b010`. (an add `+` would carry the bit but that\'s just not how the `|` operator works.) Only the `2` (`0b010`) can express a `2` (`0b010`).\n`0b100` -> `4` (ditto the above.)\n\n# Approach\nWe can store all the "scene" `powers` of two in a single integer as we loop over the initial array only once. This avoids the need to allocate a `Set`, sort the data or allocate any other extra data, meaning the solution also requires very extra little meory.\n\nWe\'ll end up with a `powers` int that representes our scene powers of two., ie. `0b011111`.\n\nWe then start from `1` (`2^0`), and move our way left to check if a power of two is missing.\n\nmin=`0b000001`, powers=`0b011111`, (min & powers)=`0b000001`\nmin=`0b000010`, powers=`0b011111`, (min & powers)=`0b000010`\nmin=`0b000100`, powers=`0b011111`, (min & powers)=`0b000100`\nmin=`0b001000`, powers=`0b011111`, (min & powers)=`0b001000`\nmin=`0b010000`, powers=`0b011111`, (min & powers)=`0b010000`\nmin=`0b100000`, powers=`0b011111`, (min & powers)=`0b000000`\n\nWe could our min power of two not in `powers`, `0b100000` which is `32`!\n\nWe can also use some JavaScript V8 optimization hints (this may change at some point in the future) such as `|0` to try to help the compiler to recognize and optimize these values as integers.\n\n# Complexity\n- Time complexity: O(n)\n\n- Space complexity: O(1)\n\n# Code\n```\nvar minImpossibleOR = function(nums) {\n    let powers = 0|0;\n    let n = 0 |0;\n    let min = 1|0;\n    for(let i = (nums.length - 1)|0; i >= 0; i--) {\n        n = nums[i] |0;\n        if ((n & (n - 1)) === 0) { // power of two\n            powers = powers | n;\n        }\n    }\n    while ((min & powers) === min) { // this min is not present in powers.\n        min = min << 1;\n    }\n    return min;\n};\n```
['JavaScript']