Skip to content

Practice Maximum Strong Pair XOR I

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#2932
LeetCode Problem

Maximum Strong Pair XOR I

Problem Statement

Choose x and y from nums such that |x-y| <= min(x,y). Choosing the same array value twice is allowed. Return the greatest bitwise XOR x XOR y among all qualifying pairs.

Source: Maximum Strong Pair XOR I on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [1,2,3,4,5]
Output
7

# Example 2

Input
nums = [10,100]
Output
0

# Example 3

Input
nums = [5,6,25,30]
Output
7

Constraints

1 <= nums.length <= 50
1 <= nums[i] <= 100

Related LeetCode Problems

Practice more problems similar to Maximum Strong Pair XOR I.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.