educative.io

Educative

Why ignore better solution?

Backtracking solution gives a better space complexity O(N) according to leetcode. I guess why should I learn this approach if I could be hit with a follow up during interview on how to improve the space complexity?

1 Like

I agree. I don’t really understand why we need to learn recursion using bfs, not dfs.


Course: Grokking the Coding Interview: Patterns for Coding Questions - Learn Interactively
Lesson: Subsets (easy) - Grokking the Coding Interview: Patterns for Coding Questions