(String[] args)
| 82 | } |
| 83 | |
| 84 | public static void main(String[] args) { |
| 85 | Scanner sc = new Scanner(System.in); |
| 86 | int t = sc.nextInt(); |
| 87 | |
| 88 | while (t-- > 0) { |
| 89 | int n = sc.nextInt(); |
| 90 | |
| 91 | int num = sc.nextInt(); |
| 92 | Node head = newNode(num); |
| 93 | Node tail = head; |
| 94 | |
| 95 | for (int i = 0; i < n - 1; i++) { |
| 96 | num = sc.nextInt(); |
| 97 | tail.next = newNode(num); |
| 98 | tail = tail.next; |
| 99 | } |
| 100 | |
| 101 | int pos = sc.nextInt(); |
| 102 | makeLoop(head, pos); |
| 103 | |
| 104 | ans x = new ans(); |
| 105 | x.removeLoop(head); |
| 106 | |
| 107 | if (detectLoop(head) || length(head) != n) |
| 108 | System.out.println("0"); |
| 109 | else |
| 110 | System.out.println("1"); |
| 111 | } |
| 112 | } |
| 113 | } |
| 114 | // } Driver Code Ends |
| 115 |
nothing calls this directly
no test coverage detected