points, and point i carries a label, the letter labels[i].
Consider squares centred at the origin with sides parallel to the axes; a side of zero length is allowed. A point is inside a square if it lies within it or on its border. A square is acceptable when no two points inside it share a label.
Return the largest number of points an acceptable square can contain.points=[[1, 0], [0, -2], [3, 3], [-2, 1]], labels='abca' → 1
A square with half-side 2 covers [1, 0], [0, -2] and [-2, 1], but the first and the last share the label a. A square with half-side 1 covers only [1, 0]. The answer is 1.
points=[[0, 0], [2, -1], [-1, 2], [5, 0]], labels='xyzx' → 3
A square with half-side 2 covers three points labelled x, y and z. Reaching [5, 0] would bring in a second x.
points=[[4, 4], [-4, 1]], labels='qq' → 0
len(points) ≤ 10⁵len(labels) = len(points)points[i] = [x, y], -10⁹ ≤ x, y ≤ 10⁹labels consists of lowercase English letterspoints=[[1, 0], [0, -2], [3, 3], [-2, 1]], labels='abca'
1
Run checks the first 3 tests in your browser. Submit checks all 79 tests on the server, hidden ones included.