Algorithms, Data Structures, DFS, Bfs, Graphs.
look: function buildAdjacencyList(A, B) { const adjList = {}; for (let i = 1; i <= A; i++) { adjList[i] = []; } for (const edge of B) { const [node1, node2] = edge; adjList[node1].push(node2); adjList[node2].push(node1); // Since it's an undirected graph, add both directions. } return adjList; }