Alexa has two stacks of non-negative integers, stack A=[a0,a1,…….am-1] and stack B=[b0,b1,…………bn-1] where index 0 denotes the top of the stack. Alexa challenges Nick to play the following game Game of Two Stacks Hackerrank : In each move, Nick can remove one integer from the top of either stack A or stack B. Nick keeps a running sum of the integers he removes from the two stacks. Nick is disqualified from the game if, at any point, his running sum becomes greater than some integer x given at the beginning …

Home » Data Structure » Stack

# Category: Stack

Have you ever tried to make stacks..?? Not only through coding but in your real life also.As in a party or event, a stack of plates.If NO..then Here is your chance to give it a Try.For example, you have three stacks of cylinders where each cylinder has the same diameter, but they may vary in height. You can change the height of a stack by removing and discarding its topmost cylinder any number of times....

File and Stack you have heard about these words, they are the heartbeat for a DS and C programming. But If you have studied files and stacks, you often thought what is the need of it.Is there any real time application in which file or stack is implemented. So the answer is YES! Here we will give a real time live example which is needed for a bookshop. But before this example you should learn or revise these topics. So, …

Maximum Element Hackerrank You have an empty sequence, and you will be given N queries. Each query is one of these three types: 1 x -Push the element x into the stack. 2 -Delete the element present at the top of the stack. 3 -Print the maximum element in the stack. Input Format The first line of input contains an integer, N. The next N lines each contain an above mentioned query. (It is guaranteed that each query is valid.) …