Design Stack using Dynamic Array | Stack Problem | Java with Generics

4 years ago Lalit Bhagtani 0
Problem Statement Design a Stack (LIFO) data structure using Dynamic Array. The Stack data structure will supports the following operations: push(N) :- It insert element N onto the top of the stack. pop() :- It removes and returns the element from the top of the stack. peek() :- It returns (not remove) the element from Read More

Design Queue using Linked List | Queue Problem | Java with Generics

4 years ago Lalit Bhagtani 0
Problem Statement Design a Queue (FIFO) data structure using Linked List. The Queue data structure will supports the following operations: enqueue(N) :- It insert element N to the back of the queue. dequeue() :- It removes and returns the element from the front of the queue. peek() :- It returns (not remove) the element from Read More

Design Stack using Linked List | Stack Problem | Java with Generics

4 years ago Lalit Bhagtani 0
Problem Statement Design a Stack (LIFO) data structure using Linked List. The Stack data structure will supports the following operations: push(N) :- It insert element N onto the top of the stack. pop() :- It removes and returns the element from the top of the stack. peek() :- It returns (not remove) the element from Read More

Implement Queue using Stacks | Queue Problem

4 years ago Lalit Bhagtani 0
Problem Statement Design a Queue (FIFO) data structure using Stack (LIFO). The Queue data structure will supports the following operations: enqueue(N) :- It insert element N to the back of the queue. dequeue() :- It removes and returns the element from the front of the queue. peek() :- It returns (not remove) the element from Read More

Implement Stack using Queues | Stack Problem

4 years ago Lalit Bhagtani 0
Problem Statement Design a Stack (LIFO) data structure using Queue (FIFO). The Stack data structure will supports the following operations: push(N) :- It insert element N onto the top of the stack. pop() :- It removes and returns the element from the top of the stack. peek() :- It returns (not remove) the element from Read More

Next Greater Element | LeetCode 496

4 years ago Lalit Bhagtani 0
Problem Statement You are given two arrays (without duplicates) A and B, where A elements are a subset of array B. Write a program to find the next greater element for each element of array A in the corresponding places of array B. The next greater element of an element x in array A is Read More

Valid Parentheses | LeetCode 20

4 years ago Lalit Bhagtani 0
Problem Statement You have given a string consist of characters ‘(‘, ‘)‘, ‘{‘, ‘}‘, ‘‘ only. Write a program to find out if the input string is valid or not. An input string is valid if: Open brackets must be closed by the same type of brackets, like { }, ( ), Read More

Backspace String Compare | LeetCode 844

4 years ago Lalit Bhagtani 0
Problem Statement You have given two strings S and T, write a program to check if they are equal when they are types into empty text editors. Note: # means a backspace character. Example  Input :- S = "ab#cde#", T = "ad#cd" Output :- true Input :- S = "ab##e", T = "c#d#f" Output :- Read More

Remove All Adjacent Duplicates In String

4 years ago Lalit Bhagtani 0
Problem Statement You have given a string (lowercase letters only), write a program to remove all the adjacent duplicate letters from the given string and return the modified string. The return string should not contain any adjacent duplicate letters. Example  Input :- "abbaca" Output :- "ca" Input :- "dabbacabbace" Output :- "de" Solution The Stack Read More

Design Maximum Frequency Stack Data Structure | Stack Problem

4 years ago Lalit Bhagtani 0
Problem Statement Design a Maximum Frequency Stack data structure that supports the following operations in constant time O(1). push(N) :- It insert element N onto the top of the stack. pop() :- It removes and returns the most frequent element from the stack. If there are two or more, most frequent elements, then the element Read More