Code RoomModulo with negative numbers
MediumPrep Room Coding #2085

Modulo with negative numbers

Code reviewCode quality & reviewMid–Senior~16 min

Review this Go function that buckets an event into a fixed-width time bucket (e.g. for a histogram), where `ts` is a Unix timestamp that may be negative for pre-1970 backfilled events.

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.

0:00 of about 16 min
Mark a line and say what kind of problem it is.0 findings
1func bucketStart(ts, width int64) int64 {
2 return ts - ts%width
3}
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.