LeetCode solutions

3193. Maximum Strong Pair XOR I

My accepted JavaScript solution to LeetCode problem 3193, Maximum Strong Pair XOR I, running in 2ms.

  • Difficulty: Easy
  • JavaScript
  • Runtime 2ms
  • Memory 55.9MB

Read the problem on LeetCode View on GitHub

JavaScript

Accepted on LeetCode — runtime 2ms, memory 55.9MB, accepted 2025-12-29.

javascript
var maximumStrongPairXor = function(nums) {
    let max = 0;
    for (let i = 0; i < nums.length; i++) {
        for (let j = i; j < nums.length; j++) {
            if (Math.abs(nums[i] - nums[j]) <= Math.min(nums[i], nums[j])) {
                max = Math.max(max, nums[i] ^ nums[j]);
            }
        }
    }
    return max;
};

Source