Algorithm · Capital One · Hard
You are given an integer array nums. Consider all unordered pairs of distinct indices (i, j) with 0 <= i < j < n. A pair is good if, starting from the two numbers nums[i] and nums[j], you can apply at most one operation that makes the two values equal. The allowed operation is: Pick exactly one of the two numbers (either nums[i] or nums[j]). In that chosen number's decimal representation, swap any two digits exactly once. (You may also choose to swap nothing, which counts as…
Checking your access…