Pinterest Coding 2024, Can't solve using AI either
Anonymous User
589

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

Comments (4)