max( bits from multiple numbers OR bits from any number not in current number OR num LSH k )
Time complexity: $O(n)$ - we iterate over nums twice\n- Space complexity: $O(1)$ - we use constant auxiliary memory with 6 temporary variables\ngolang []\nfunc 
- Time complexity: $O(n)$ - we iterate over nums twice\n- Space complexity: $O(1)$ - we use constant auxiliary memory with 6 temporary variables\n```golang []\nfunc maximumOr(nums []int, k int) int64 {\n    // O(n) - determine bits that appear in multiple numbers and those that appear in any number\n    appearsInMultiple := 0\n    appearsInAny := 0\n    for _, num := range nums {\n        appearsInMultiple |= appearsInAny & num\n        appearsInAny |= num\n    }\n\n    // O(n) - determine maximum number we can form by taking\n    // bits that appear in multiple numbers, bits that appear\n    // in any number that don\'t appear in current num, and bits\n    // we get from LSH of current num by k\n    max := int64(appearsInAny)\n    for _, num := range nums {\n        n := int64(appearsInMultiple) | int64(appearsInAny & ^num) | int64(num) << k\n        if n > max {\n            max = n\n        }\n    }\n\n    return max\n}\n```\n```python3 []\nclass Solution:\n    def maximumOr(self, nums: List[int], k: int) -> int:\n        # O(n) - determine bits that appear in multiple numbers and those\n        # that appear in any number\n        appearsInMultiple = 0\n        appearsInAny = 0\n        for num in nums:\n            appearsInMultiple |= appearsInAny & num\n            appearsInAny |= num\n\n        # O(n) - determine maximum number we can form by taking\n        # bits that appear in multiple numbers, bits that appear\n        # in any number that don\'t appear in current num, and bits\n        # we get from LSH of current num by k\n        maximum = appearsInAny\n        for num in nums:\n            maximum = max(maximum, appearsInMultiple | appearsInAny & ~num | num << k)\n\n        return maximum\n```\n```typescript []\nconst maximumOr = (nums: number[], k: number): number => {\n    // O(n) - determine bits that appear in multiple numbers and those\n    // that appear in any number\n    let appearsInMultiple = 0n, appearsInAny = 0n\n    for (let num of nums) {\n        appearsInMultiple |= appearsInAny & BigInt(num)\n        appearsInAny |= BigInt(num)\n    }\n\n    // O(n) - determine maximum number we can form by taking\n    // bits that appear in multiple numbers, bits that appear\n    // in any number that don\'t appear in current num, and bits\n    // we get from LSH of current num by k\n    let maximum = appearsInAny\n    for (let num of nums) {\n        const n = appearsInMultiple | appearsInAny & ~BigInt(num) | BigInt(num) << BigInt(k)\n        if (n > maximum) {\n            maximum = n\n        }\n    }\n\n    return Number(maximum)\n}\n```\n```javascript []\nconst maximumOr = (nums, k) => {\n    // O(n) - determine bits that appear in multiple numbers and those\n    // that appear in any number\n    let appearsInMultiple = 0n, appearsInAny = 0n\n    for (let num of nums) {\n        appearsInMultiple |= appearsInAny & BigInt(num)\n        appearsInAny |= BigInt(num)\n    }\n\n    // O(n) - determine maximum number we can form by taking\n    // bits that appear in multiple numbers, bits that appear\n    // in any number that don\'t appear in current num, and bits\n    // we get from LSH of current num by k\n    let maximum = appearsInAny\n    for (let num of nums) {\n        const n = appearsInMultiple | appearsInAny & ~BigInt(num) | BigInt(num) << BigInt(k)\n        if (n > maximum) {\n            maximum = n\n        }\n    }\n\n    return Number(maximum)\n}\n```\n\nSolutions for other problems in biweekly contest 104:\n\n- [2678. Number of Senior Citizens\n](/problems/number-of-senior-citizens/solutions/3520347/go-extract-11th-12th-character-and-check-if-60/)\n- [2679. Sum in a Matrix\n](/problems/sum-in-a-matrix/solutions/3520365/go-sort-rows-in-onm-log-m-time-then-determine-max-per-column/)
['Go', 'TypeScript', 'Python3', 'JavaScript']