We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
@pooleapply, I'm curious what your thought is on using one actual array for a stack, then using Array.prototype.reverse(). My solution passed, but I think it may be too slow. Do you have other suggestions?
Queues: A Tale of Two Stacks
You are viewing a single comment's thread. Return to all comments →
@pooleapply, I'm curious what your thought is on using one actual array for a stack, then using
Array.prototype.reverse()
. My solution passed, but I think it may be too slow. Do you have other suggestions?I think the problem with
Reverse
is it devolvesPush()
Pop()
operations ofO(1)
toO(n)
which is significantly slower.