Combinatorial Optimization
Combinatorics
Dynamic Programming
Holiday Tech
Apr 11, 2026
Solving the Secret Santa Problem with Dynamic Programming
Learn how to count valid Secret Santa assignments using derangements and dynamic programming. Step-by-step guide with Python code, recurrence relations, and O(1) space optimization.