Ways to Wear Distinct Hats
Given n people each with a list of hats they like, count the number of ways to assign a distinct hat to each person from hats labeled 1 to 40. Return the answer modulo 10^9 + 7.
Given n people each with a list of hats they like, count the number of ways to assign a distinct hat to each person from hats labeled 1 to 40. Return the answer modulo 10^9 + 7.