We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
My Solution in Java given below:-
import java.util.;
import java.math.;
public class Solution {
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int T=sc.nextInt();
for(int i =0;i<T;i++)
{
int N=sc.nextInt();
int M=sc.nextInt();
Project Euler #15: Lattice paths
You are viewing a single comment's thread. Return to all comments →
My Solution in Java given below:- import java.util.; import java.math.; public class Solution {
BigInteger path = fact(BigInteger.valueOf(N+M)) .divide(fact(BigInteger.valueOf(N))) .divide(fact(BigInteger.valueOf(M))) .mod((BigInteger.valueOf(1000000007))); System.out.println(path.toString());
static BigInteger fact(BigInteger num) { if (num == BigInteger.ZERO) return BigInteger.ONE;
}