Geohash cells form a rectangular grid at every precision. Nearby-search systems often begin with a cell and its eight compass neighbors before applying exact distance filtering.
Design GeohashNeighborFinder.neighbors(geohash). Use alphabet 0123456789bcdefghjkmnpqrstuvwxyz. Each character contributes five high-to-low bits, interleaved longitude first, then latitude. Interpret the longitude and latitude bit streams as unsigned grid indices.
Return neighbors in order N, NE, E, SE, S, SW, W, NW, at the same precision. Longitude wraps across the antimeridian. Latitude does not wrap: when a movement crosses a pole, return "" in that direction. Use integer grid operations rather than decoded floating-point centers.
Example 1:
Example 2:
Constraints
1 <= geohash.length <= 12- Every character belongs to the standard lowercase geohash alphabet.