Code Room
Code reviewHard
Question
Review this Java polynomial string hash used to shard keys across `n` backends.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
int shard(String key, int n) { int h = 0; for (int i = 0; i < key.length(); i++) { h = h * 31 + key.charAt(i); } return h % n;}Run or narrate your approach, then ask the coach.