Keyword to Algorithm

"Top k"

"How many ways.."






"X Sum"

"Max/longest sequence"


"Partition/split ... array/string"





"Connected component", "Cut/remove" "Regions/groups/connections"

Transitive relationship

If the items are related to one another and the relationship is transitive, then chances are we can build a graph and use BFS or Union Find.


  • Greedy: sort by start/end time and then go through sorted intervals Interval Pattern