Available question text
Find the largest non-negative integer k such that the permutation nums can be sorted by swapping only pairs of elements whose bitwise AND equals k. Equivalently, determine the maximum k for which the graph with vertices as positions (or values) and edges between entries with nums[i] & nums[j] == k has connected components that each contain the target values needed to place every element in sorted order.
Related questions
Continue with questions that share topics or the same question type.
- Maximum Sum Obtained of Any Permutation
Coding
- All the Pairs With the Maximum Number of Common Followers
Coding
- Average Salary Excluding the Minimum and Maximum Salary
Coding
- Binary Tree Maximum Path Sum
Coding · Binary Tree · Depth-First Search · DP on Trees
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 3644. Maximum K to Sort a Permutation
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source