another slower approach
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution(object):\n    def maximumOr(self, nums, k):\n        """\n        :type nums: List[int]\n        :type k: int\n        :rtype: int\n        """\n        max_binary_length = len(format(max(nums), \'b\'))\n\n        no_duplicate_dict = {}\n        max_prefix = \'\'\n        for num in nums:\n            if max_binary_length - len(format(num, \'b\')) > 0:\n                continue\n            else:\n                prefix = format(num << k, \'b\')[:k]\n                if prefix > max_prefix:\n                    max_prefix = prefix\n                if prefix in no_duplicate_dict:\n                    no_duplicate_dict[prefix].append(num)\n                else:\n                    no_duplicate_dict[prefix] = [num]\n\n        max_num_list = no_duplicate_dict[max_prefix]\n        max_total = 0\n        for max_num in max_num_list:\n            total = 0\n            flag = True\n            for num in nums:\n                if (max_num == num) & flag:\n                    flag = False\n                    total = total | (num << k)\n                else:\n                    total = total | num\n            if total > max_total:\n                max_total = total\n\n        return max_total\n```
['Python']