← Meta Interview Insights

Meta·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Meta coding screen with a twist on a classic problem. Nothing crazy but the decimal handling tripped me up more than I expected.

Questions Asked (1)

Q1

Given two non-negative numeric strings that may include a decimal point, return their sum as a string without using any built-in numeric conversion functions. After computing the result, strip any trailing zeros from the decimal part.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

I knew the add-strings pattern going in, integer version is pretty standard.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify that the core challenge is simulating decimal addition without numeric conversion. Propose splitting the strings into integer and fractional parts, padding the fractional parts to equal length, then performing digit-by-digit addition from right to left with carry handling. Finally, strip trailing zeros from the fractional part and combine with the integer sum.

Pro tip: Mention that you would first ask about constraints (e.g., maximum length, presence of leading zeros) to decide between a simple simulation and a more optimized approach. Also, emphasize that you would write helper functions for string reversal and carry propagation to keep the code clean and testable.

1. Clarify requirements and edge cases

Ask about input constraints (e.g., max length, leading zeros, empty strings) and confirm that the result should be a string with trailing zeros stripped. Discuss edge cases like '0.0', '0', and numbers with no decimal point.

2. Split and normalize

Split each string into integer and fractional parts. Pad the fractional parts with zeros on the right so they have equal length. Also, pad the integer parts with leading zeros on the left to equalize their lengths.

3. Add fractional parts

Iterate from the end of the fractional parts to the beginning, summing digits and propagating carry. Store the result in a list or string builder.

4. Add integer parts

Continue the addition with the integer parts, starting from the least significant digit, including any carry from the fractional part. Handle the final carry if it remains.

5. Format and strip trailing zeros

Combine the integer and fractional results, remove trailing zeros from the fractional part, and omit the decimal point if the fractional part becomes empty. Return the final string.

Key Points to Mention

  • Simulating digit-by-digit addition with carry propagation.
  • Handling of decimal points by splitting into integer and fractional parts.
  • Padding to align digits for addition.
  • Stripping trailing zeros from the fractional part after addition.
  • Edge cases: empty strings, all zeros, numbers without decimal points, and leading zeros.
  • Time and space complexity: O(n) where n is the maximum length of the input strings.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.