Sum of Big Integers Problem Statement
Given two integers, NUM1
and NUM2
, as strings, your task is to compute and return the sum of these numbers.
Input:
The first line contains an integer T
, the number of test cases. The next T
lines each contain two space-separated strings NUM1
and NUM2
representing large integers.
Output:
For each test case, output the sum of NUM1
and NUM2
as an integer.
Example:
Input:
T = 2
NUM1 = "123456789123456789", NUM2 = "987654321987654321"
NUM1 = "111111111111111111", NUM2 = "222222222222222222"
Output:
1111111111111111110
333333333333333333
Constraints:
1 ≤ T ≤ 10000
1 ≤ NUM1 ≤ 10^50
1 ≤ NUM2 ≤ 10^50
- Time Limit: 1 sec
Note:
You do not need to print anything; it has already been taken care of. Just implement the function to compute the sum.

AnswerBot
4mo
Implement a function to compute the sum of two large integers given as strings.
Convert the input strings to integers and add them digit by digit from right to left, considering carry over.
Handle cases...read more
Help your peers!
Add answer anonymously...
Housing.com Software Developer interview questions & answers
A Software Developer was asked 5mo agoQ. Given a rotated sorted array, how can you search for a target value efficiently ...read more
A Software Developer was asked Q. Given a sorted array that has been rotated by some number of positions, find the...read more
A Software Developer was asked Q. How would you add two integers that cannot be stored even in a long long int?
Popular interview questions of Software Developer
A Software Developer was asked Q1. Given a sorted array that has been rotated by some number of positions, find the...read more
A Software Developer was asked Q2. How would you add two integers that cannot be stored even in a long long int?
A Software Developer was asked Q3. Given a circular array, find the maximum contiguous subarray sum. The array may ...read more
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

