Trains the technique from
LeetCode 415Add StringsThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
An archival telescope keeps its shutter counters as decimal text, because the running totals outgrow every machine word the logger owns. You are handed two such counters, left and right, each a string of digits with no leading zeros unless the counter itself is "0".
Return the sum of the two counters, again as a digit string with no leading zeros.
The logger has no arbitrary-precision arithmetic available, so you must stay on the characters: do not convert left or right into a built-in big integer, do not call a library routine that parses a numeric string for you, and do not hand the work to a big-number package.
Example 1
The two counters total 942, reported in the same digit-string form.
Example 2
The total is 4000, which is as many digits as the longer counter.
Example 3
The total is 100, one digit longer than either counter.
Example 4
Adding the zero counter leaves the other counter unchanged.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def add_strings(left: str, right: str) -> str:public String addStrings(String left, String right)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.