HARDasked at 2 companies

Number of Great Partitions

A hard-tier problem at 32% community acceptance, tagged with Array, Dynamic Programming. Reported in interviews at Sprinklr and 1 others.

Founder's read

Number of Great Partitions is a hard dynamic programming problem that appears in assessments at Sprinklr and Darwinbox. With a 32% acceptance rate, it's a serious filter. Most candidates struggle because the problem sits at the intersection of array partitioning and counting, and the greedy intuition that works on easier DP problems will tank you here. If you hit this on your OA and haven't drilled the pattern, StealthCoder solves it invisibly in seconds. This is exactly the kind of problem where one bad assumption costs you the entire solution.

Companies asking
2
Difficulty
HARD
Acceptance
32%

Companies that ask "Number of Great Partitions"

If this hits your live OA

Number of Great Partitions is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by an Amazon engineer who used it to pass JPMorgan's OA and system design loop.

Get StealthCoder
What this means

The trick is recognizing what makes a partition 'great' and building DP state accordingly. Naive approaches either iterate through all partitions (exponential) or misidentify which subsets satisfy the constraint. The pattern: define your DP state as the count of valid partitions for the first i elements, tracking what information you actually need to maintain at each step. Most candidates either over-track state (memory blow-up) or under-track it (wrong answer). The solution requires careful boundary conditions and understanding when a partition is complete. If you're seeing TLE or WA, you've chosen the wrong state variables. StealthCoder detects the correct DP formulation and surfaces it immediately during the live assessment, letting you code with confidence instead of guessing.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Number of Great Partitions recycles across companies for a reason. It's hard-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by an Amazon engineer who used it to pass JPMorgan's OA and system design loop. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Number of Great Partitions interview FAQ

Is this problem asking for all partitions or counting them?+

You're counting valid partitions, not enumerating them. That's the speed trap. A direct enumeration approach will timeout. You need DP to avoid recomputing the same subproblems. Focus on the state transition, not the partitions themselves.

What makes a partition 'great' and how do I validate it?+

The problem specifies what qualifies as great, and that constraint is the key to your DP state. Read the constraint carefully. Your DP transition must check this condition at every step. If your solution doesn't explicitly validate the constraint in the recurrence, you're on the wrong track.

How do I know if I need O(n^2) or O(n) space?+

Depends on what state you track. If you track indices and partition properties, you'll likely need 2D DP. Some optimizations let you roll to 1D. Start with correctness, then optimize space. At hard difficulty with a 32% pass rate, most candidates are failing logic, not space complexity.

Will greedy work for any subproblem here?+

No. Greedy fails because the 'greatness' constraint couples partitions in ways that make local optimization wrong. You must consider all valid partitions. Pure DP with proper state is required, not greedy plus DP.

Are Sprinklr and Darwinbox asking this to filter hard or to test specific skill?+

Both companies use this problem, suggesting it tests DP mastery and careful constraint handling. It's a differentiator. If you haven't practiced state-machine-style DP before, this will feel alien. Study the pattern, then drill similar constraint-driven DP problems.

Want the actual problem statement? View "Number of Great Partitions" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.