Addition Under Modulo
Sat Feb 05 2022 12:20:21 GMT+0000 (Coordinated Universal Time)
Saved by @Uttam #java #additionundermodulo #mathematics #gfg #geeksforgeeks
9. Addition Under Modulo Given two numbers a and b, find the sum of a and b. Since the sum can be very large, find the sum modulo 10^9+7. Example 1: Input: a = 9223372036854775807 b = 9223372036854775807 Output: 582344006 Explanation: 9223372036854775807 + 9223372036854775807 = 18446744073709551614. 18446744073709551614 mod (10^9+7) = 582344006 Example 2: Input: a = 1000000007 b = 1000000007 Output: 0 Explanation: 1000000007 + 1000000007 = (2000000014) mod (10^9+7) = 0 Your Task: You don't need to read input or print anything. Your task is to complete the function sumUnderModulo() that takes a and b as input parameters and returns sum of a and b under modulo 10^9+7. Expected Time Complexity: O(1) Expected Auxilliary Space: O(1) Constraints: 1 <= a,b <= 2^63 - 1
https://practice.geeksforgeeks.org/problems/addition-under-modulo/1/?track=DSASP-Mathematics&batchId=190
Comments