Skip to content
DeepForgeby svx
All problems
EasyNLPnlp-419

LSH Band Bucket Keys

Problem

In banded LSH, a signature is split into consecutive bands; candidates collide when a band key matches. Build the per-band keys by joining the signature values in each band with hyphens, using zeros to pad the final partial band.

Given the signature and the band size, return the list of band key strings.

Hint

Chunk the signature from left to right and pad the last chunk.

Test cases

case 1
in: [[1,2,3,4],2]
expected: ["1-2","3-4"]
case 2
in: [[5,6,7],2]
expected: ["5-6","7-0"]
case 3
in: [[9],1]
expected: ["9"]
Starter codePython
def lsh_band_bucket_keys(signature, band_size):
    # Your code here
    pass

3 test cases · run your code against them in the editor