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
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
JavaScript
Accepted on LeetCode — runtime 2ms, memory 55.9MB, accepted 2025-12-29.
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;
};