Skip to content
Courses
DSA to Development
Get IBM Certification
Newly Launched!
Master Django Framework
Become AWS Certified
For Working Professionals
Interview 101: DSA & System Design
Data Science Training Program
JAVA Backend Development (Live)
DevOps Engineering (LIVE)
Data Structures & Algorithms in Python
For Students
Placement Preparation Course
Data Science (Live)
Data Structure & Algorithm-Self Paced (C++/JAVA)
Master Competitive Programming (Live)
Full Stack Development with React & Node JS (Live)
Full Stack Development
Data Science Program
All Courses
Tutorials
Data Structures & Algorithms
ML & Data Science
Interview Corner
Programming Languages
Web Development
CS Subjects
DevOps And Linux
School Learning
Practice
GfG 160: Daily DSA
Problem of the Day
Practice Coding Problems
GfG SDE Sheet
DSA
Practice Problems
C
C++
Java
Python
JavaScript
Data Science
Machine Learning
Courses
Linux
DevOps
SQL
Web Development
System Design
Aptitude
GfG Premium
Sign In
▲
Similar Topics
DSA
22.5k+ articles
C++
4.2k+ articles
Strings
3.2k+ articles
Competitive Programming
2.3k+ articles
Algorithms
2k+ articles
STL
1.2k+ articles
Data Structures
1.1k+ articles
Stack
420+ articles
cpp-containers-library
92 articles
cpp-stack
78 articles
cpp-stack-functions
28 posts
Popular Articles
Recent Articles
Design a dynamic stack using arrays that supports getMin() in O(1) time and O(1) extra space
Last Updated: 27 August 2021
Design a special dynamic Stack using an array that supports all the stack operations such as push(), pop(), peek(), isEmpty(), and getMin()
...read more
Stack
interview-preparation
Data Structures
cpp-stack
cpp-stack-functions
System-Design
DSA
Reversing a Stack using two empty Stacks
Last Updated: 24 August 2021
Given a stack S, the task is to reverse the stack S using two additional stacks.Example:Input: S={1, 2, 3, 4, 5}Output: 5 4 3 2 1Explanation
...read more
Stack
Reverse
cpp-stack
cpp-stack-functions
DSA
Program to insert an element at the Bottom of a Stack
Last Updated: 15 April 2025
Given a stack s containing n integers and an integer x, the task is to insert the element x at the bottom of the stack.Examples:Input:x = 7s
...read more
Stack
Recursion
Data Structures
cpp-stack
cpp-stack-functions
DSA
Similar Topics
DSA
22.5k+ articles
C++
4.2k+ articles
Strings
3.2k+ articles
Competitive Programming
2.3k+ articles
Algorithms
2k+ articles
STL
1.2k+ articles
Data Structures
1.1k+ articles
Stack
420+ articles
cpp-containers-library
92+ articles
cpp-stack
78+ articles
Reversing a Stack with the help of another empty Stack
Last Updated: 30 November 2023
Given a Stack consisting of N elements, the task is to reverse the Stack using an extra stack.Examples:Input: stack = {1, 2, 3, 4, 5}Output:
...read more
Stack
Reverse
cpp-stack-functions
DSA
Check if a string is a subsequence of another string ( using Stacks )
Last Updated: 07 November 2023
Given a string S, the task is to check if the string target is a subsequence of string S or not, using a Stack.Examples:Input: S = ”KOTTAY
...read more
Strings
Stack
subsequence
cpp-stack-functions
DSA
Implementing Stack Using Class Templates in C++
Last Updated: 02 February 2022
The task is to implement some important functions of stack like pop(), push(), display(), topElement(), isEmpty(), isFull() using class temp
...read more
Stack
C++
Templates
cpp-stack-functions
DSA
Minimize a string by removing all occurrences of another string
Last Updated: 27 May 2022
Given two strings S1 and S2 of length N and M respectively, consisting of lowercase letters, the task is to find the minimum length to which
...read more
Strings
Stack
substring
cpp-stack-functions
DSA
Important functions of STL Components in C++
Last Updated: 02 November 2023
[tabby title="C++"][sourcecode language="cpp"]// C++ code#include iostream#include utilityusing namespace std;int main(){ // Declaring th
...read more
Articles
Stack
Queue
Competitive Programming
STL
cpp-vector
C++
Data Structures
C++ Programs
cpp-unordered_map
cpp-queue
cpp-map
cpp-set
cpp-stack
cpp-list
cpp-priority-queue
cpp-unordered_map-functions
cpp-stack-functions
cpp-map-functions
DSA
Check if any K ranges overlap at any point
Last Updated: 26 March 2025
Given N ranges [L, R] and an integer K, the task is to check if there are any K ranges that overlap at any point.Examples:Input: ranges[][]
...read more
Stack
Searching
Technical Scripter
cpp-stack-functions
Technical Scripter 2019
DSA
Interval
stack emplace() in C++ STL
Last Updated: 30 May 2023
Stacks are a type of container adaptors with LIFO(Last In First Out) type of working, where a new element is added at one end (top) and an e
...read more
STL
C++
cpp-stack
cpp-stack-functions
stack swap() in C++ STL
Last Updated: 24 July 2024
Stacks are a type of container adaptors with LIFO(Last In First Out) type of work, where a new element is added at one end and (top) an elem
...read more
STL
C++
cpp-stack
cpp-stack-functions
stack::push() and stack::pop() in C++ STL
Last Updated: 11 January 2025
The stack::push() and stack::pop() method in stack container is used to insert and delete the element from the top of stack. They are the me
...read more
STL
CPP-Library
C++
cpp-containers-library
cpp-stack
cpp-stack-functions
stack top() in C++ STL
Last Updated: 14 February 2025
In C++, the std::stack::top() is used to find the top element of the std::stack container. It is a member function of std::stack class defin
...read more
STL
CPP-Library
C++
cpp-containers-library
cpp-stack
cpp-stack-functions
stack empty() and stack size() in C++ STL
Last Updated: 08 April 2025
The std::stack::size() and std::stack::empty() in C++ are built-in functions that are used to provide information about the size of the stac
...read more
STL
CPP-Library
CPP-Functions
C++
cpp-containers-library
cpp-stack
cpp-stack-functions
Stack in C++ STL
Last Updated: 28 February 2025
In C++, stack container follows LIFO (Last In First Out) order of insertion and deletion. It means that most recently inserted element is re
...read more
Stack
STL
C++
cpp-containers-library
cpp-stack
cpp-stack-functions
1
2
>>
Last
1
2
>>
Last
1
2
>>
Last
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our
Cookie Policy
&
Privacy Policy
Got It !