LC - Datadog Flashcards

1
Q

Buffered file

A

You know it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Logs and queries

A

Build query hash
Query hash to Id
Inverted index - word to query Id
For each word in log - for each query Id that contains it, add it to a list for the query Id
For each query Id, build a hash with all the words in the log and compare with original hash to Id dictionary

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Maximum tree path sum

A

Post order DFS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Frequency of words

A

Dictionary

“”.join(c.lower() for c in s if c not in string.punctuation)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

File system

A

Basic recursion.

isDir()
findList()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

High performance filters

A

Build map from index to tags list
Build inverted index from tags to list of indexes
For each tag in the filter, add to the set of Ids that contain the tag.
Iterate through the set, check if the tag list contains all tags, and extend the result list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly