The first element of an edge is where it comes from, not where it points.
Acceptance criteria
- 1.#out should show indegree 1.
The first element of an edge is where it comes from, not where it points.
const edges = [[0, 1], [1, 2]]; const indeg = [0, 0, 0]; for (const [a] of edges) indeg[a]++; document.querySelector('#out').textContent = "indegree " + indeg[2];
Output ready when you are
Press Run to render your code, or Submit to validate your solution.