Cube Sum Pairs Problem Statement
Given a positive integer N
, find the number of ways to express N
as a sum of cubes of two integers, A
and B
, such that:
N = A^3 + B^3
Ensure you adhere to the following conditions:
A
must be greater than or equal to 1 (A≥1).B
must be greater than or equal to 0 (B≥0).- Pairs
(A, B)
and(B, A)
are distinct unlessA = B
.
Input:
The first line contains an integer T
, representing the number of test cases.
Each test case consists of a single positive integer N
.
Output:
For each test case, return an integer denoting the count of ways to represent N
as a sum of cubes of two integers, A
and B
.
Example:
Input:
2
N = 9
N = 16
Output:
2
0
Constraints:
- 1 ≤ T ≤ 103
- 1 ≤ N ≤ 108
- Time Limit: 1 sec
Be the first one to answer
Add answer anonymously...
Top Paytm Android Developer interview questions & answers
Popular interview questions of Android 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