• + 3 comments

    The variables i and j represent the numbers in the set (1 through n). By using the double for-loop, we will cycle through all possible combinations of these numbers. We apply the relevant bitwise operators to each pair (&, |, ^). If the value is greater than any previous results, but still less than k, we update the max values accordingly.