0415. Add Strings
Easy | String + Math | 28 ms (97.36%), 14.2 MB (83.13%)
Last updated
Was this helpful?
Easy | String + Math | 28 ms (97.36%), 14.2 MB (83.13%)
Last updated
Was this helpful?
Source: GitHub:
Given two non-negative integers, num1
and num2
represented as string, return the sum of num1
and num2
as a string.
You must solve the problem without using any built-in library for handling large integers (such as BigInteger
). You must also not convert the inputs to integers directly.
Since two strings might have different lengths, we need to take care of the condition when either one of strings meets the beginning first.