Safe Add (Number or BigInt)

JavaScript Medium 4 views
Back to Questions

Problem Description

Two integers are given as strings. If both fit safely in JavaScript Number and the sum is also safe, print the sum as Number. Otherwise print the sum using BigInt.

Input Format

One line: A B (integer strings).

Output Format

One line sum.

Sample Test Case

Input:
9007199254740991 1
Output:
9007199254740992

Constraints

|A|,|B| up to 10^100000.

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next