Preparing for an interview? Check out Cracking the Coding Interview
Published on

Microsoft | SDE 2

Author
  • Shared Anonymously

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.

ReportMark as Helpful