
Jumping Game Problem Statement
In this problem, you have ‘n’ carrots lined up and denoted by numbers 1 through ‘n’. There are ‘k’ rabbits, and each rabbit can jump to carrots that are multiples of its unique jumping factor.
Rabbits start from the same point, and each time a rabbit lands on a carrot, it eats some of it. Your task is to calculate how many carrots remain uneaten after all rabbits have finished jumping.
Input:
The first line contains an integer ‘T’, representing the number of test cases.
For each test case:
The first line contains two integers, ‘n’ and ‘k’, denoting the number of carrots and rabbits, respectively.
The second line contains ‘k’ space-separated integers; each integer is a rabbit's jumping factor.
Output:
Output a single integer for each test case, representing the number of carrots that remain uneaten.
Example:
Input:
1
10 2
2 3
Output:
3
Constraints:
- 1 ≤ ‘T’ ≤ 50
- 1 ≤ ‘n’, ‘k’ ≤ 3000
- 1 ≤ A[j] ≤ n, for all j from 1 to k
Note: You are not required to handle any input/output operations. Implement the given function to solve the problem.


Calculate uneaten carrots after rabbits jump based on their unique factors.
Iterate through each rabbit's jumping factor and mark the carrots they land on as eaten
Calculate the remaining uneaten carrot...read more

Top Nagarro Technical Trainee interview questions & answers
Popular interview questions of Technical Trainee
Reviews
Interviews
Salaries
Users/Month