#Easy GFG : Print adjacency list

Link: https://www.geeksforgeeks.org/problems/print-adjacency-list-1587115620/1

class Solution {
    public List<List<Integer>> printGraph(int V, int edges[][]) {

        int totalEdges = edges.length;

        List<List<Integer>> adjList = new ArrayList<>();
        for(int i=0 ; i<V ; i++){
            adjList.add(new ArrayList<Integer>());
        }

        for(int i=0 ; i<totalEdges ; i++){
          adjList.get(edges[i][0]).add(edges[i][1]);  
          adjList.get(edges[i][1]).add(edges[i][0]);
        }

        return adjList;
    }
}