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
13d

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
Stay ahead in your career. Get AmbitionBox app
qr-code
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

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter