Skip to content

Commit

Permalink
fix(tutorials): broken formula
Browse files Browse the repository at this point in the history
  • Loading branch information
wingkwong committed Jan 28, 2024
1 parent 8a3354e commit 7092c64
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tutorials/math/combinatorics.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ $b$ $=$ $\frac{k \, - \, endPos \, + \, startPos}{2}$

Then the solution is $k \choose a$ $=$ $k \choose b$ as we need to find number of ways to choose $a$ or $b$ moves, out of $k$ moves.

Thus, we need to find $nCr$$(k, \frac{k - endPos + startPos}{2})$.
Thus, we need to find $nCr$ $(k, \frac{k - endPos + startPos}{2})$.

To implement this, you can both precompute the entire Pascal's Triangle, or use concept of mudular inverses to find the required value.

Expand Down

0 comments on commit 7092c64

Please sign in to comment.