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
AnswerBot
4mo

Given an integer N, divide it into K positive parts to maximize their product.

  • Divide N into K parts such that their sum equals N

  • Maximize the product of the K parts

  • Constraints: 1 ≤ T ≤ 11, 2 ≤ N ≤ 55

  • Ex...read more

Help your peers!
Select
Add answer anonymously...

Top Software Engineer Interview Questions Asked at Info Edge

Q. What is Dijkstra's algorithm and how is it applied to graph theory?
Q. What are the pillars of OOPS?
Q. Given a set of coin denominations and a target value, find the minimum number of...read more
Software Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits