Code Room
Code reviewHardcr-g262
Subject Off by oneLevel Mid–Senior~20 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

Review this Go binary search that returns the index of the first element >= target (lower bound).

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.

Talk through your review
Code to reviewgo
func lowerBound(a []int, target int) int {    lo, hi := 0, len(a)-1    for lo < hi {        mid := (lo + hi) / 2        if a[mid] < target {            lo = mid + 1        } else {            hi = mid        }    }    return lo}
Run or narrate your approach, then ask the coach.