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, and NUM1 and NUM2 are the numbers given as strings.
  • Time Limit: 1 sec
AnswerBot
4mo

Program to compute sum of big integers represented as strings.

  • Convert strings to integers and add them digit by digit from right to left, considering carry over.

  • Handle cases where one number is longer...read more

Vaishu Sumthankar
3y

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!
Select
Add answer anonymously...

Amazon Program Analyst interview questions & answers

A Program Analyst was asked Q. Longest Common Prefix Problem Statement You are given an array ‘ARR’ consisting ...read more
A Program Analyst was asked Q. Longest Common Subsequence Problem Statement Given two strings STR1 and STR2, de...read more
A Program Analyst was asked Q. Closest Sum Problem Statement Given an array of integers ARR of size N and an in...read more

Popular interview questions of Program Analyst

A Program Analyst was asked Q1. Longest Common Prefix Problem Statement You are given an array ‘ARR’ consisting ...read more
A Program Analyst was asked Q2. Longest Common Subsequence Problem Statement Given two strings STR1 and STR2, de...read more
A Program Analyst was asked Q3. Closest Sum Problem Statement Given an array of integers ARR of size N and an in...read more
Amazon Program Analyst Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
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

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

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits