Grokking Data Structures & Algorithms for Coding Interviews
0% completed
Solution: Generate Binary Numbers from 1 to N
.....
.....
.....
Like the course? Get enrolled and start learning!
A
Anonymous
· 2 years ago
You don't need to put(s2) as it is never looked at. We only ever peek once per iteration (only access index of -1 once).
A
Anonymous
· 3 years ago
The solution is optimized for time for fails a tad with space. If you notice, no matter how what number we pass, we will always have twice as many numbers in the queue because of the way we are storing this. we can actively guard against this with some conditional clauses.
Show 3 replies
Reading Progress
0%