New update is available. Click here to update.

Last Updated: 7 Jul, 2021

Difficulty: Hard

```
The first line contains a single integer 'T' denoting the number of test cases to be run. Then the test cases follow.
The first line contains two integers, 'N' and 'K', where N represents the sequence length.
The next line contains N integers, 'ai' for (0 <= i <= N-1).
```

```
Print N integers, where ith element denotes the count of different paths from 1st element to ith element.
Output for each test case will be printed in a separate line,
```

```
You are not required to print anything; it has already been taken care of. Just implement the function.
```

```
1 <= T <= 10
1 <= N <= 5 * 10^4
1 <= K <= 10^9
1 <= ai <= 10^5
Time limit: 1 sec
```

SIMILAR PROBLEMS

Distance to a Cycle in Undirected Graph

Posted: 7 Nov, 2022

Difficulty: Moderate

Ninja And The Strictly Increasing Array

Posted: 27 Nov, 2022

Difficulty: Moderate

Maximum GCD

Posted: 8 Dec, 2022

Difficulty: Hard

Prime?

Posted: 9 Dec, 2022

Difficulty: Easy

Co-Prime

Posted: 14 Dec, 2022

Difficulty: Hard

Popular Interview Problems: