Design Max Stack Data Structure | Stack Problem

4 years ago Lalit Bhagtani 0
Problem Statement Design a 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 element from the top of the stack. peek() :- It returns (not remove) the element from the top of the Read More

Design Min Stack Data Structure | Stack Problem

4 years ago Lalit Bhagtani 0
Problem Statement Design a 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 element from the top of the stack. peek() :- It returns (not remove) the element from the top of the Read More

Check if Coordinates make a Straight Line | Array Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given an array of coordinates, write a program to find out if an array of coordinates make a straight line in the 2D plane. Each coordinate is an array of two values x and y, where x represents a coordinate point on X-axis and y represents the coordinate point on Y-axis Read More

Relative Ranks | Array Problem | LeetCode 506

4 years ago Lalit Bhagtani 0
Problem Statement You have given a scores of N athletes, write a program to find out their relative ranks. Athletes with the top three highest scores will be awarded medals: “Gold Medal“, “Silver Medal“, “Bronze Medal“. Example  Input :- Output :- Gold Medal, Silver Medal, Bronze Medal, 4, 5, Input Read More

Transpose Matrix | Array Problem

4 years ago Lalit Bhagtani 0
Problem Statement The transpose of a matrix is a new matrix whose rows are the columns of the original matrix. You have given a matrix A, write a program to return the transpose of given matrix A. Example  Input :- , , ] Output :- , Read More

Peak Index in a Mountain Array | Array Problem

4 years ago Lalit Bhagtani 0
Problem Statement An array A is a mountain array, if the following properties hold true: Length of an array is greater than equal to 3 (A.length >= 3). Only one peak element exist in the array. Peak element at index i follows (A < A < … A < A > A > … > Read More

Find Peak Element in Array | Array Problem

4 years ago Lalit Bhagtani 0
Problem Statement A peak element is an element, which is greater than its neighbors. You have given an array of integers N, where N != N, Write a program to find out the peak element in the given array and return its index. In the case of multiple peaks, return the index of any one Read More

Duplicate Zeros in Array | Array Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given an array of integers, duplicate each occurrence of zero and shift the remaining elements to the right. Elements beyond the length of the array are dropped (not written). Note: Implement this with modifications in input array only. Example  Input :- Output Read More

Find Common Characters in Array of Strings | Array Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given an array of strings (lowercase characters only), write a program to return a list of all characters (including duplicates) which is present in all strings of an array. For example, if a character occurs 3 times in all strings, then include that character three times in the result. Example  Input Read More

Find the Duplicate Number in Array | Array Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given an array N, containing n + 1 integer elements, where each integer element is between 1 (inclusive) and n (inclusive). Write a program to return the duplicate integer. Note: Integer array N contains only one duplicate integer. Example  Input :- Output :- 3 Read More