Microsoft | SDE 2

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2023-07-29Added By Anonymous
Source: Link

OA : Two questions

1. Backtracking Question

2. https://leetcode.com/problems/group-anagrams/


Round 1: Given a set of patterns and a string. Remove given set of patterns from string and output the string without any trace of those patterns.

For example: str = "aebcd", pattern = {"ad", "ec","b"}

returns "" empty string

Explanation: "aebcd" -> "aecd" -> "ad" -> ""


Note: I was not able to solve the question with optimised approach. Although it looks similar to https://leetcode.com/problems/remove-all-occurrences-of-a-substring/ . Really appreciate if you can provide solution of the problem.

Comments