Facebook/Meta | Phone Screen | New Grad | Minimum Add Valid Parentheses + Pattern Match

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2022-01-08Added By Anonymous
Source: Link

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

Original Post Content:

I had two questions in the Phone Screen interview:

Q1: https://leetcode.com/problems/minimum-add-to-make-parentheses-valid/

- Solved the first question with O(n) - Time complexity and O(1) - Space complexity. It took me around 15-20 minutes to explain the process and to write the code

Q2: https://leetcode.com/problems/valid-word-abbreviation/
Given a pattern similar to i18n check if the input string matches it.
Examples:
- f6k should match facebook, but not focus
- Similarly F2eb2k or 8 should match Facebook
- Print(match("8k", "Facebook")) # Return False
- Print(match("8k", "Faceboook")) # Return True
- Print(match("F2eb2k", "Facebook")) # Return True
- Print(match("i18n", "internationalization")) # Return True
- Print(match("i18n", "interpolation")) # Return False

Comments