Break The Integer Problem Statement
Given an integer N
, the task is to divide this integer into 'K' positive parts (where K ≥ 2
) such that their sum equals N
. The objective is to maximize the product of these 'K' parts.
Input:
The first line contains an integer 'T', representing the number of test cases.
Each of the next 'T' lines contains a single integer 'N'.
Output:
For each test case, return the maximum product achievable by dividing 'N' into 'K' parts.
Example:
Input:
T = 2
4
10
Output:
4
36
Explanation:
For N = 4
, breaking it into parts [2, 2]
gives product 4
.
For N = 10
, breaking it into parts [3, 3, 4]
gives product 36
.
Constraints:
1 ≤ T ≤ 11
2 ≤ N ≤ 55
- Time Limit: 1 sec
Be the first one to answer
Add answer anonymously...
Top Info Edge Software Engineer interview questions & answers
Popular interview questions of Software Engineer
Top HR questions asked in Info Edge Software Engineer
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