Leetcode 1434. Number of Ways to Wear Different Hats to Each Other
Count the number of ways to assign distinct hats (labels 1..40) to n ≤ 10 people given each person's allowed hat list, returning the answer mod 1e9+7. This is typically solved with bitmask DP over subsets of people (iterating hats and assigning them to feasible, currently-unassigned people) to avoid exploring all permutations.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.