Implement Two Stacks in an Array | GFG POTD | Stack | C++ | Java | Code Kar Lo

preview_player
Показать описание
Your task is to implement 2 stacks in one array efficiently. You need to implement 4 methods.
push1 : pushes element into first stack.
push2 : pushes element into second stack.
pop1 : pops element from first stack and returns the popped element. If first stack is empty, it should return -1.
pop2 : pops element from second stack and returns the popped element. If second stack is empty, it should return -1.

0:00 Introduction
0:10 Problem Statement
1:15 Explanation
5:48 C++ Code
7:56 Java Code

gfg potd
gfg potd today
gfg problem of the day
potd gfg
potd
potd today
gfg

#dsa #datastructures #algorithm #gfg #potd #coding #array #strings #tree #binarysearchtree #codekarlo #dynamicprogramming
Рекомендации по теме
Комментарии
Автор

thank 🙏you bhaiya for your explanation in a very simple manner.

ayushchouhan