Locality-sensitive hashing avoids comparing every pair of MinHash signatures. It divides signatures into bands and treats an exact match in any band as a candidate similarity.
Design MinHashLshCandidateFinder.candidatePairs(int[][] signatures, int bands). Every row is one document signature. Divide its columns into bands equal, consecutive slices. Documents i and j are candidates when at least one corresponding slice is identical. Return unique pairs [i,j], with i < j, sorted by i and then j.
Example 1:
Example 2:
Constraints
0 <= signatures.length <= 10^4- All signatures have the same positive length, divisible by
bands. - The total number of returned candidate pairs is at most
2 * 10^5.