Facebook | Phone | Enterprise Engineer | Addition of String Numbers

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2020-03-25Added By Anonymous
Source: Link

Company: Meta (Facebook)
Role: e3, e4
Interview Stage: Phone Screen
Location: unknown
Year: unknown

Original Post Content:

Problem: Given 2 strings `str1` and `str2`, which represent numbers in string, perform addition of the numbers and return the result as a string.

Example 1: `str1 = "123.52"` and `str2 = "11.2"`, output should be `"134.72"`
Example 2: `str1 = "110.75"` and `str2 = "9"`, output should be `"119.75"`

Constraints: You may not convert entire string to integer directly. Strings may be null and will always have values >=0.0

Comments