Hi, I saw that this problem is categorized into DFS. When I use BFS to do it, it takes O(1) space as instructed by the problem. But when I use DFS, I have to use O(h) space, and that is not what the problem instructed, right? Then why is this problem categorized into DFS? Or is there anyway to use DFS with constant space?
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.