Please enter your email address or userHandle.
Given three numbers a, b and c such that a, b and c can be at most 1016. The task is to compute (a*b)%c
Input: a = 4, b = 3, c = 5
Explanation: (4 * 3) = 12 and
12 % 5 = 2
Input: a = 1000000000007,
b = 10000000000005, c = 1000000000000003
Explanation: You can calculate it by youself.
You don't need to read input or print anything. Your task is to complete the function mulMod() which takes a, b, c as inputs and returns the answer.
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)
1 ≤ a, b, c ≤ 1016
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Login to access your submissions.
Please choose 'ReadOnlyMode' if you needn't to 'Edit' the problem e.g. viewing OJ's solution, TestCase Files (TCFs), TimeLimit etc.