Skip to content

Category Archives: Stack

Given a string str, the task is to check if it is possible to split the given string into even length palindromic substrings. Examples:   Input: str… Read More
Given an array arr[] of positive and negative integers, the task is to print the array after the removal of adjacent array elements starting from… Read More
Given an array arr[], the task is to find the sum of decomposition value of the suffixes subarray. Decomposition Value: Decomposition value of a subarray… Read More
Given S stacks of length M, the task is to maximize the sum of elements at the top of each stack by popping at most… Read More
Given an array arr[] containing N integers, the task is to rearrange the array such that the odd indexed elements are in reverse order.Examples: Input:… Read More
Given a string representing infix notation. The task is to convert it to an expression tree.Expression Tree is a binary tree where the operands are… Read More
Given a queue Q containing N strings, the task is to restructure the queue to double its size such that the second half represents the… Read More
A balanced sequence is defined as a string in which for every opening bracket there are 2 continuous closing brackets. Thus, {}}, {{}}}}, {{}}{}}}} are… Read More
Given a number N, the task is to write C/C++ program to print the number from N to 1 by calling the main() function using… Read More
Given an unsorted array of length N. The task is to sort the array, such that abs(a[i]-a[i+1]) < = abs(a[i+1]-a[i+2]) for all 0 < =… Read More
Data structure is a way of storing and organising data efficiently such that the required operations on them can be performed efficiently with respect to… Read More
Given a Binary Tree and an integer K where the tree has positive and negative nodes, the task is to print the elements of the… Read More
Given an array arr[], the task is to find the minimum steps required to make an array decreasing, where in each step remove all elements… Read More
Pre-requisites: Java Collection Framework. 1. What is the Output of following Java Program? filter_none edit close play_arrow link brightness_4 code import java.util.*;    class Demo… Read More