← Meta Interview Insights

Meta·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
May 2026

Summary

Meta software engineering interview with a mix of string manipulation and a sneaky math problem. The palindrome question felt approachable but the decimal addition follow-up was a different beast entirely.

Questions Asked (2)

Q1

Given a string, determine whether any permutation of its characters can form a palindrome. Follow-up: if such a permutation exists, generate and return one valid palindrome.

Algorithms & Data Structures
Author's notes

The core check is straightforward once you realize a palindrome can have at most one character with an odd frequency count.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, explain that a palindrome permutation is possible if at most one character has an odd frequency. Then, for the follow-up, describe how to construct a palindrome by placing half of each character's count on the left, mirroring it on the right, and placing the odd-count character (if any) in the middle.

Pro tip: Clarify edge cases upfront (empty string, single character, all same characters) and discuss time/space complexity (O(n) time, O(1) space for fixed alphabet) to show thoroughness.

1. Clarify requirements and edge cases

Confirm whether the string contains only lowercase letters, uppercase, or any characters. Discuss edge cases like empty string, single character, and strings with all identical characters.

2. Determine possibility using frequency counts

Count the frequency of each character. If more than one character has an odd count, return false; otherwise, return true.

3. Construct the palindrome (follow-up)

For each character with count c, append c/2 copies to the left half. If a character has an odd count, set it aside as the middle character. Then mirror the left half to form the right half.

4. Analyze complexity and optimize

State that the algorithm runs in O(n) time and O(1) space (for a fixed alphabet). Mention that using a hash map or array for counts is efficient.

5. Test with examples

Walk through examples like 'aab' (possible, 'aba') and 'abc' (impossible) to validate the logic and construction.

Key Points to Mention

  • Palindrome property: at most one character can have an odd frequency.
  • Use a frequency array or hash map to count characters.
  • Construction: left half + middle (if any) + reverse(left half).
  • Time complexity O(n) and space O(1) for fixed alphabet.
  • Edge cases: empty string, single character, all same characters.
  • Follow-up: if multiple odd counts, return empty string or indicate impossibility.

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

Q2

Implement addition of two non-negative numbers represented as strings, where either number may include a decimal point. You cannot use any built-in arbitrary-precision numeric types.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

This one blindsided me.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Normalize both strings by padding the integer and fractional parts to equal lengths, then perform digit-by-digit addition from right to left, handling carries. Finally, trim leading zeros in the integer part and trailing zeros in the fractional part, and insert the decimal point if needed.

Pro tip: Clarify edge cases upfront (e.g., empty strings, multiple decimal points, leading zeros) and discuss how you'd handle them, showing attention to detail. Also, mention that you can avoid string reversal by using indices from the end, which is more memory-efficient.

1. Clarify and Validate Input

Ask about input constraints: non-negative numbers, may have decimal points, no built-in big number types. Confirm handling of edge cases like empty strings, leading zeros, and multiple decimal points.

2. Normalize the Numbers

Split each string into integer and fractional parts. Pad the shorter integer part with leading zeros and the shorter fractional part with trailing zeros so both numbers have equal length in each part.

3. Add Fractional Parts

Starting from the rightmost digit of the fractional parts, add digits along with any carry. Store the result and propagate the carry to the integer part addition.

4. Add Integer Parts

Starting from the rightmost digit of the integer parts, add digits along with the carry from the fractional part. Continue until all digits are processed, handling any final carry.

5. Format the Result

Remove leading zeros from the integer part (but keep at least one zero if the integer part is empty) and trailing zeros from the fractional part. If the fractional part is non-empty, insert a decimal point between the integer and fractional parts.

Key Points to Mention

  • Handling carries correctly, especially across the decimal point.
  • Normalization by padding to align digits, which simplifies addition.
  • Edge cases: empty strings, numbers with no integer part (e.g., '.5'), numbers with no fractional part (e.g., '5.'), and all zeros.
  • Time and space complexity: O(n) time and O(n) space where n is the length of the longer input string.
  • Avoiding built-in big number types by manual string manipulation.
  • Potential trade-offs: in-place modification vs. creating new strings, and using indices vs. reversing strings.

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