Joined
Last Seen
0 Reputation Points
Unknown Quality Score
No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
0 Endorsements
Ranked #107.73K
1 Posted Topic
Use two stacks. Lets name that as addStack and removeStack. Call addStack.push() method in enequeue() and in dequeue(), check whether removeStack is empty. If it is empty, copy the elements off addStack in reverse order to removeStack and flush addStack(). So now in dequeue() invoke, removeStack.pop(). Simple.
The End.
krssanthosh