LeetCode 415: Add Strings is the core problem associated with Meta interviews under tags String, Math, and Simulation. This problem simulates manual addition digit-by-digit without using built-in numeric conversion.
Given two non-negative integers represented as strings num1 and num2, return the string of their sum. You must not use any built-in BigInteger library or convert the inputs to actual integers or other number types.[1][9]
Iterate from the end of both strings, adding digits plus any carry, then build the result in reverse and reverse it at the end. This mimics hand-written addition.[1]
| Input | Output | Explanation | |-------|--------|-------------| | num1 = "11", num2 = "123" | "134" | 11 + 123 = 134 [1] | | num1 = "456", num2 = "77" | "533" | 456 + 77 = 533 [1] | | num1 = "0", num2 = "0" | "0" | 0 + 0 = 0 [1] |
Meta often asks a harder version with decimals (e.g., "91.465" + "72.8"), requiring separate integer/decimal addition using the above as a helper function, plus handling edge cases like varying decimal places.[7][1]