JavaScript O(nlgn) Easy to Understand
Intuition\nSort nums asc, and move the edge of coverage forward.\n# Approach\nSort nums asc, and move the edge of coverage forward.\n# Complexity\n- Time comple
# Intuition\nSort nums asc, and move the edge of coverage forward.\n# Approach\nSort nums asc, and move the edge of coverage forward.\n# Complexity\n- Time complexity:\nO(nlgn)\n- Space complexity:\nO(1)\n# Code\n```\n/**\n * @param {number[]} nums\n * @return {number}\n */\nvar minImpossibleOR = function(nums) {\n    nums.sort((a, b) => a - b)\n    const minVal = nums[0]\n    if (minVal > 1) return 1\n\n\n    const len = nums.length\n    function countDigits(x) {\n        let result = 0\n        for (; x !== 0; x >>= 1)\n            result++\n        \n        return result\n    }\n\n\n    let edge = 2\n    for (let i = 1; i < len; i++) {\n        const val = nums[i]\n        if (val > edge) {\n            return edge\n        }\n\n        const digitCount = countDigits(val)\n        const nextEdge = 1 << digitCount\n        edge = Math.max(edge, nextEdge)\n    }\n\n\n    return edge\n};\n```
['JavaScript']