Code Room
Code reviewHardcr-g303
Subject Missing cacheLevel Mid–Senior~20 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

Review this Go function that prices a bill of materials by recursively expanding sub-assemblies. Deep trees with shared sub-assemblies are extremely slow.

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 cost(part string, bom map[string][]string, price map[string]float64) float64 {    total := price[part]    for _, child := range bom[part] {        total += cost(child, bom, price)    }    return total}
Run or narrate your approach, then ask the coach.