content: class Solution {
      public boolean validPath(int n, int[][] edges, int source, int destination) {
          // Store all edges according to nodes in 'graph'.
          Map<Integer, List<Integer>> graph = new HashMap<>();
          for (int[] edge : edges) {
              int a = edge[0], b = edge[1];
              graph.computeIfAbsent(a, val -> new ArrayList<Integer>()).add(b);
              graph.computeIfAbsent(b, val -> new ArrayList<Integer>()).add(a);
          }
          
          // Start from source node, add it to stack.
          boolean[] seen = new boolean[n];
          seen[source] = true;
          Stack<Integer> stack = new Stack<>();
          stack.push(source);
          
          while (!stack.isEmpty()) {
              int currNode = stack.pop();
              if (currNode == destination) {
                  return true;
              }
              // Add all unvisited neighbors of the current node to stack'
              // and mark it as visited.
              for (int nextNode : graph.get(currNode)) {
                  if (!seen[nextNode]) {
                      seen[nextNode] = true;
                      stack.push(nextNode);
                  }
              }
          }
          
          return false; 
      }
  }