Reversing an Array
Just push each item onto the stack and then pop it back off. Because of the stack's LIFO nature, the items come back out in reverse order.
Runtime : we do two iteration over the array
Last updated
Just push each item onto the stack and then pop it back off. Because of the stack's LIFO nature, the items come back out in reverse order.
Runtime : we do two iteration over the array
Last updated