You are viewing a single comment's thread. Return to all comments →
For a faster approach, notice that maximum input limit of k is 10^18.
For n=1000, all r>7 exceeds kmax. From this we can conclude that we just need to find that r for which nCr exceeds k.