Ninja Competition Problem Statement
Ninja is organizing a coding competition where two teams compete at a time. To keep it fair and interesting, both teams must have an equal number of members. Ninja’s task is to form these two teams.
For this task, Ninja receives an integer 'N'. For each divisor 'D' of 'N' (including 1 and N), members are added as follows:
- To the first team if 'D' is even.
- To the second team if 'D' is odd.
Your task is to determine if Ninja can create two teams with equal members given 'N'.
Example:
Input:
N = 10
Output:
true
Explanation:
Divisors of 10 are: 1, 2, 5, 10.
The first team will have two members from divisors 2 and 10. The second team will have two members from divisors 1 and 5. Hence, the answer is true.
Constraints:
- 1 <= T <= 100
- 1 <= N <= 105
- ΣN over all test cases doesn’t exceed 105
- Time Limit: 1 sec
Check if Ninja can create two teams with equal members given an integer N and its divisors.
Iterate through all divisors of N and assign members to the first or second team based on whether the divisor...read more
Top Bottomline Software Developer interview questions & answers
Popular interview questions of Software Developer
Top HR questions asked in Bottomline Software Developer
Reviews
Interviews
Salaries
Users/Month