When there’re two methods, I’ll always pick the easier ones.
This is a traditional combinatorial problem. It’s equivalent to, given
m-1 black blocks and
n-1 red blocks, the total number of combinations within.
It’s equivalent because there are (m-1) downs, and (n-1) rights to go; one can go in any order.
Java’s BigInteger is used to avoid overflow problem.
A factorial lookup table is pre-computed to avoid duplicate calculation.