2020 Pinterest Coding Interview (Onsite): Detect Bad Phrases

Justin Holiday
Jan 17, 2021

In this video, I go over another coding interview I received from Pintreset during the onsite. The interview question was:

Q. Given a list of bad phrases and a query, detect whether the given query contains any bad phrases

This question was fairly simple compared to other interview questions. The video explains:

  • brute force approach
  • optimized approach using trie
  • code solutions for both approaches

Here is the code snippet of the optimized approach using trie:

If you have any questions or suggestions, feel free to comment here or in the youtube video and let’s discuss! Thanks for reading!

--

--