Full table: space. But each row only depends on the previous row. Use two arrays: and . Swap after each coin. Space: . Or use single array with reverse iteration: , iterating from down to . Time: , Space: . The pattern is identical to 0/1 Knapsack space reduction. space reduction works because each row only depends on the previous row. Use two arrays or reverse iteration.
Time complexity: .
Space complexity: .