Got Runtime Error
Hey I was solving this with using BigInteger class and getting runtime error, although I fixed all corner test cases. Here is my java code:

import java.util.*;
import java.lang.*;
import java.math.BigInteger;

class Main
    public static void main (String[] args)
        Scanner scanner = new Scanner(;
        int t=scanner.nextInt();
            long n=scanner.nextLong();
            int k=scanner.nextInt();
            if(n<k||n==0 || k==0){
            BigInteger N=new BigInteger(Long.toString(n));
            BigInteger ans=new BigInteger("1");
            BigInteger one=new BigInteger("1");
            for(int i=1;i<=k;++i){
                BigInteger I= new BigInteger(Integer.toString(i));

Check this once---------> NoSuchElementException for nextInt

It’s working fine with custom test cases…

What I’ve noticed in your code is that you are trying to convert a number of type (Integer or Long) to Big Integer and store it as a Biginteger , what if your Input(n or k or both) is (2^64 - 1) :wink: . Instead, you can declare that n, k variables as BigInteger type and perform required operations on them.Also, I think you’ve missed two tricks or cases or conditions or whatever that will make things easier(like TLE escape).
Please Correct me if i’m wrong. :sweat_smile:
I’ve made it easier for you by adding comments. Here is my AC code

1 Like

I see thanks.:smiley::smiley:

//P.S Remove this 20char limit