Combination Sum IV
Medium · Dynamic Programming · about 15 minutes
Asked at Google, Meta, Amazon, Snap, ByteDance, Discord, Match Group, Twitch.
nums holds distinct positive integers. Count the sequences of values from nums (repeats allowed) whose total is target, where different orderings count as different sequences. The count fits in a signed 32-bit integer.