Sum Numbers As Strings
Start Timer
0:00:00
Given two string representations of very large integers, create a Python function, string_sum
, that returns the sum of these two integers as a string. Each string integer may start with a '+'
or '-'
sign.
Treat these strings as if they were extremely large (gigabytes in size), so usual conversion methods to integers don’t work due to memory constraints.
Example:
Input:
num1 = "+123456789"
num2 = "-987654321"
Output:
def string_sum(num1, num2) -> "-864197532"
Recommended questions for you
Personalized based on your user activity, skill level, and preferences.
.
.
.
.
.
.
.
.
.
Comments