Company: Zeta_8aug
Difficulty: medium
Number of Ways to Reach Island N Problem Description You are given a fixed, directed graph containing several islands. Your task is to find the number of distinct paths from Island 1 to a given Island N. The input consists of multiple test cases. The first line contains an integer T , representing the number of test cases. For each test case, a single integer N is provided, denoting the target island. For each test case, your program should return a long long integer representing the total number of ways to reach Island N from Island 1. The structure of the graph is implicit and demonstrated by the provided examples. Examples Example 1: This example demonstrates the overall input/output format and the first test case. Input: 3 2 4 6 Output: 1 2 3 Explanation: The first line of the input indicates T = 3 test cases. The subsequent lines provide the target island N for each test case. For N = 2 : Input: N = 2 Output: 1 Explanation: There exists only 1 way to reach Island 2 from Island 1: