Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Vote For New Content
In the JS solution, what's the point of using deque? Wouldn't an array be fine h...

Yogi Paturu

Dec 23, 2021

In the JS solution, what's the point of using deque? Wouldn't an array be fine here, since array push and pop are O(1) operations

1

0

Comments
Comments
A
Athanasios Petsas4 years ago

I believe in the C++ solution we could avoid removing the current node from current path for backtracking if we pass the currentPath variable by value instead of by reference (removing the '&' in front of it) only for currentPath. For allPaths of course we need it as we...

On this page