Maximize the Product of a Positive Integer Split

Quick Overview

Maximize the Product of a Positive Integer Split. Split n into at least two positive integers and return the largest possible product of the parts. The parts must sum to n; returning n without any split is not

Maximize the Product of a Positive Integer Split

Company: TCS

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Other

### Problem Split n into at least two positive integers and return the largest possible product of the parts. The parts must sum to n; returning n without any split is not allowed. ```cpp int integerBreak(int n); ``` ### Examples ```text n = 8 -> 18 n = 3 -> 2 ``` ### Constraints - 2 <= n <= 58.

Overview: Maximize the Product of a Positive Integer Split. Split n into at least two positive integers and return the largest possible product of the parts. The parts must sum to n; returning n without any split is not

TCS logo
TCS
Source window: 0–3 months · as of Oct 21, 2026
mediumSoftware EngineerOtherCoding & Algorithms
0
0

Problem

Split n into at least two positive integers and return the largest possible product of the parts. The parts must sum to n; returning n without any split is not allowed.

int integerBreak(int n);

Examples

n = 8 -> 18
n = 3 -> 2

Constraints

  • 2 <= n <= 58.