Mathematics

A method to mock a new instance in the class is using the powermockito. Powermockito has a function whenNew. This one can be used to solve this kind of problem.

One approach is to notice - after some trial and error - that the number of paths at each node is represented by the equivalent entry in Pascal's triangle. So in general for a NxN grid one would construct Pascal's triangle up to height 2N and take the entry in the center position of the last row.

Subscribe to Mathematics