Question: can someone please help me to write this logic. here input needs to be read from scanner class and i am not able to understand

can someone please help me to write this logic. here input needs to be read from scanner class and i am not able to understand how can i convert it into array or arraylist
Scanner s = new Scanner(System.in);
String s1=s.next(); // this returns "[[1,2],[3],[3],[]]" but not as an arraylist
 can someone please help me to write this logic. here input

Description Given a directed acyclic graph (DAG) of n nodes labeled from 0 ton-1, count all possible paths from node O to noden - 1, and return the number of paths. The graph is given as follows: graph[i) is a list of all nodes you can visit from node i (.e., there is a directed edge from node i to node graph[i][]). Example: 0 1 2 3 Input: graph = [[1,2],[3),(3,01 Output: 2 Explanation: There are two paths: 0-> 1 -> 3 and 0 -> 2 -> 3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!