Add Strings

Easy

Topics
MathStringSimulation

Given two non-negative integers num1 and num2 represented as strings, return their sum as a string. You must not convert the inputs to integers directly or use a big-integer library.

Example 1

Input:  num1 = "11", num2 = "123"
Output: "134"

Example 2

Input:  num1 = "456", num2 = "77"
Output: "533"

Example 3

Input:  num1 = "0", num2 = "0"
Output: "0"

Constraints

  • 1 <= num1.length, num2.length <= 10^4
  • num1 and num2 consist of only digits.
  • num1 and num2 do not contain any leading zero except the number 0 itself.
Run ⌘' · Submit ⌘⏎