Goldman SachsSoftware Engineer · Take-home ProjectCodemia practiceTransform matrix to adjacency list
Given a matrix representation of a graph, where each element indicates the presence of an edge between nodes, transform this matrix into an adjacency list format. The input will be a 2D array of integers, and the output should be a list of lists, where each sublist contains the adjacent nodes for each node in the graph. Ensure that the solution handles both directed and undirected graphs appropriately.
Medium
Coding & Algorithms