Skip to content
DeepForgeby svx
All problems
MediumProbabilitypr-068

Integer Partition Count

Problem

Count the integer partitions of n, the ways to write n as a sum of positive integers where order does not matter.

Use the standard coin-change style dynamic programming table. Return 0 for negative n and 1 for n = 0.

Hint

Process each allowed part once so order does not matter.

Test cases

case 1
in: [0]
expected: 1
case 2
in: [5]
expected: 7
case 3
in: [10]
expected: 42
case 4
in: [20]
expected: 627
Starter codePython
def integer_partition_count(n):
    # Your code here
    pass

4 test cases · run your code against them in the editor