(String[] args)
| 117 | } |
| 118 | |
| 119 | public static void main (String[] args){ |
| 120 | Scanner sc = new Scanner(System.in); |
| 121 | int t = sc.nextInt(); |
| 122 | |
| 123 | while(t--> 0) |
| 124 | { |
| 125 | int n = sc.nextInt(); |
| 126 | |
| 127 | int num = sc.nextInt(); |
| 128 | Node head = newNode(num); |
| 129 | Node tail = head; |
| 130 | |
| 131 | for(int i=0; i<n-1; i++) |
| 132 | { |
| 133 | num = sc.nextInt(); |
| 134 | tail.next = newNode(num); |
| 135 | tail = tail.next; |
| 136 | } |
| 137 | |
| 138 | int pos = sc.nextInt(); |
| 139 | makeLoop(head, pos); |
| 140 | |
| 141 | Solution x = new Solution(); |
| 142 | x.removeLoop(head); |
| 143 | |
| 144 | if( detectLoop(head) || length(head)!=n ) |
| 145 | System.out.println("0"); |
| 146 | else |
| 147 | System.out.println("1"); |
| 148 | } |
| 149 | } |
| 150 | } |
nothing calls this directly
no test coverage detected