LeetCode Question · Mar 2025

Pinterest Coding 2024, Can't solve using AI either

27 views 4 replies

Question Details

I was asked this in pinterest coding interview and I couldn\'t solve it optimally. please help You are given a list of dictionary which looks like below [{id: 1, username: \'hermoine\', text:...

Full Details

I was asked this in pinterest coding interview and I couldn\'t solve it optimally. please help

You are given a list of dictionary which looks like below
[{id: 1, username: \'hermoine\', text: \'i am person who doens\'t have a favourite\'},
{id: 2, username: \'ron\', text: \'i am my own favorite but personally I care about one person}
]

It has a celebrity , message id and message (sort of like tweets)
Now the question was , given list of set of keywords and list of usernames, fetch it there is any result matching.. just a true or false will do
for example if input is ([["own favourite"], ["person"]] , [hermoine, ron]) ---> id2 fits in..
Follow up, what if input keywords are a lot of words.. this can be a list.

I did filter by username first, and for every user filtered texts I ran the keyword match. However this isn\'t super efficient. beyond this I am need ideas on how to solve

About This Question

This is a reported interview question from a pinterest interview for a swe role during the coding round reported in 2025.

It covers the following topics: Hash Table .