Sum of Big Integers Problem Statement
Given two integers represented as strings, 'NUM1' and 'NUM2', compute and return their sum.
Input:
T
NUM1 NUM2
...
Output:
Sum of NUM1 and NUM2 for each test case
Example:
Input:
2
123456789123456789123456789 987654321987654321987654321
1 999999999999999999999999999
Output:
1111111111111111111111111110
1000000000000000000000000000
Constraints:
1 <= T <= 10000
1 <= |NUM1| <= 1050
1 <= |NUM2| <= 1050
- Where:
T
is the number of test cases, andNUM1
andNUM2
are the numbers given as strings. - Time Limit:
1 sec
Vaishu Sumthankar
2y
Using Strings. Let us store ‘NUM1’ and ‘NUM2’ as strings rather than storing them as integers. We will calculate the sum as follows: We will add zeroes before the smaller string among ‘NUM1’ and ...
Help your peers!
Add answer anonymously...
Top Amazon Program Analyst interview questions & answers
Popular interview questions of Program Analyst
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app