Code RoomNull pointer dereference in map
MediumPrep Room Coding #1910

Null pointer dereference in map

Code reviewCode quality & reviewMid–Senior~15 min

Review this Go rate-limit counter increment.

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 15 min
Mark a line and say what kind of problem it is.0 findings
1type Limiter struct {
2 counts map[string]*int
3}
4 
5func (l *Limiter) Hit(key string) int {
6 c := l.counts[key]
7 *c++
8 return *c
9}
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.