package leetcode;

import java.util.LinkedList;
import java.util.List;
import java.util.Queue;

/**
 * https://leetcode.com/problems/all-paths-from-source-to-target/
 */
public class Problem797 {
    public List<List<Integer>> allPathsSourceTarget(int[][] graph) {
        // TODO
        Queue<Integer> queue = new LinkedList<>();
        while (!queue.isEmpty()) {

        }
        return null;
    }

    public static void main(String[] args) {
        Problem797 prob = new Problem797();
        System.out.println(prob.allPathsSourceTarget(new int[][]{
            {1, 2}, {3}, {3}, {}
        })); // [[0,1,3],[0,2,3]]
    }
}

@@ -12,16 +12,44 @@
 tcode;%0A%0A
+import java.util.ArrayList;%0A
 import j
@@ -302,16 +302,127 @@
 // TODO%0A
+        List%3CList%3CInteger%3E%3E result = new ArrayList%3C%3E();%0A        boolean%5B%5D visited = new boolean%5Bgraph.length%5D;%0A
         
@@ -456,32 +456,54 @@
 LinkedList%3C%3E();%0A
+        queue.add(0);%0A
         while (!
@@ -521,16 +521,268 @@
 ty()) %7B%0A
+            Integer current = queue.remove();%0A            visited%5Bcurrent%5D = true;%0A            for (int neighbor : graph%5Bcurrent%5D) %7B%0A                if (!visited%5Bneighbor%5D) %7B%0A                    visited%5Bneighbor%5D = true;%0A                %7D%0A            %7D
 %0A       
@@ -803,12 +803,14 @@
 urn 
-null
+result
 ;%0A  

Update problem 797