← 返回 twosigma 的题目列表Add Two Numeric Strings
类型:online_judge
Given two strings num1 and num2 representing non-negative integers (possibly very long), implement string-based addition and return the sum as a string.
Constraints/requirements:
Do not use big-integer libraries or convert the whole string to an integer type.
Strings contain only digits 0-9.
Input size:
1 <= len(num1), len(num2) <= 1e5
Examples:
num1 = "11", num2 = "123" -> "134"
num1 = "999", num2 = "1" -> "1000"
Also explain the time and space complexity.
Example
Input
11
123
Output
134