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
Be the first one to answer
Add answer anonymously...
Top Bottomline Software Developer interview questions & answers
Popular interview questions of Software Developer
Top HR questions asked in Bottomline Software Developer
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app