Microsoft interview question

Depth first search, hashmap(worst-case complexity)