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

Question

Review this JavaScript function used to size a dependency tree.

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 reviewjavascript
function countDeps(node, graph) {  if (!graph[node] || graph[node].length === 0) return 1;  let total = 1;  for (const child of graph[node]) {    total += countDeps(child, graph);  }  return total;}
Run or narrate your approach, then ask the coach.