Skip to main content

New answers tagged

1 vote
Accepted

How to count the number of topological sorts in a directed acyclic graph with multiple roots

The problem is #P-complete (for example, see the last example in https://en.wikipedia.org/wiki/%E2%99%AFP-complete#Examples), so you should not expect any efficient algorithm that works on all ...
D.W.'s user avatar
  • 166k
0 votes

Efficient Algorithm to Count Permutations of Boss Fights with Divisibility Constraints in an RPG Game

State Definition: Let $dp[i][s][k]$ be the number of ways to select elements from the first $i$ items such that: The sum modulo 4 is $s$ (i.e., $s = (\sum_{j=1}^{i} a_j b_j) \mod 4$) The number of ...
138 Aspen's user avatar
  • 101

Top 50 recent answers are included