educative.io

Wrong time and space complexities in Equal Subset problem

The time and space complexity in case of top-down DP with memoization should be O(Nx2^N)

This is because although the total sum is the upper boundary of all possible sum of subsets, the actual number of subsets that can be formed from a Set of N elements is 2^N.
So instead of O(NxS) (where S is the total sum), it should be O(Nx2^N).
Consider this example to understand what I mean
Array = [100, 200, 300]
total sum = 600
total number of subsets possible = 2^3 = 8