Search
⌘K

Leetcode 3141. Maximum Hamming Distances

Given an array, find the maximum Hamming distance between the array and any of its cyclic rotations — i.e., the largest number of indices i where A[i] != A[(i+shift) mod n] over all nonzero shifts. The challenge is to compute this efficiently for large n (avoid O(n^2) rotation comparisons) using string/array-matching techniques (concatenation + KMP/Z/rolling-hash) and careful handling of duplicates.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.