## Convert an unbalanced bracket sequence to a balanced sequence

Given an unbalanced bracket sequence of ‘(‘ and ‘)’, convert it into a balanced sequence by adding the minimum number of ‘(‘ at the beginning… Read More »

- Given two arrays count all pairs whose sum is an odd number
- Count substrings that contain all vowels | SET 2
- Check for balanced parentheses in an expression | O(1) space | O(N^2) time complexity
- Program to find the kth character after decrypting a string
- Maximum water that can be stored between two buildings
- Find sub-arrays from given two arrays such that they have equal sum
- Count of all possible values of X such that A % X = B
- Minimum number of adjacent swaps to convert a string into its given anagram
- Minimum possible sum of array elements after performing the given operation
- Minimum sum of two numbers formed from digits of an array in O(n)
- Split the array elements into strictly increasing and decreasing sequence
- Count pairs in an array such that the absolute difference between them is ≥ K
- Find the value of N when F(N) = f(a)+f(b) where a+b is the minimum possible and a*b = N
- Find the maximum possible value of a[i] % a[j] over all pairs of i and j
- Find out the minimum number of coins required to pay total amount
- Maximum number of candies that can be bought
- Program to print an array in Pendulum Arrangement with constant space
- Find if it is possible to make a binary string which contanins given number of "0", "1" , "01" and "10" as sub sequences
- Print the balanced bracket expression using given brackets
- Construct Binary Tree from given Parent Array representation | Iterative Approach
- Minimum operations to make frequency of all characters equal K
- Delete odd and even numbers at alternate step such that sum of remaining elements is minimized
- Total position where king can reach on a chessboard in exactly M moves | Set 2
- Count of pairs of strings which differ in exactly one position
- Maximum distance between two unequal elements
- Sort the Queue using Recursion
- Divide a number into two parts
- Find original numbers from gcd() every pair
- Length of the longest substring with no consecutive same letters
- Maximum length sub-array which satisfies the given conditions

Given an unbalanced bracket sequence of ‘(‘ and ‘)’, convert it into a balanced sequence by adding the minimum number of ‘(‘ at the beginning… Read More »

Given 21 Matchsticks and 2 users, A and B (computer and user respectively). Users can pick matchsticks not more than four at a time. The… Read More »

Given a String S of length N, two integers B and C, the task is to traverse characters starting from the beginning, swapping a character… Read More »

Given an array arr of size N. The task is to count number of triplets in the array such that a[i]>a[j]>a[k] and i<j<k Examples: Input… Read More »

Given an array a of size N. The task is to print the length of the longest alternative odd/even or even/odd subsequence. Examples: Input: a[]… Read More »

Given two integer N and X. N represents the number of rows and columns of a table. And the element at the ith row and… Read More »

Given an array arr[] of N integers. The task is to find the largest elements in the first half and the second half of the… Read More »

Given a linked list. The task is to print the difference between the first odd positioned node with the sum of all other odd positioned… Read More »

Given an array a of size N. The task is to find the maximum sum of array possible by dividing the array into three segments… Read More »

Given a balanced parenthesis string which consists of ‘(‘ and ‘)‘. The task is to find the number of balanced parenthesis substrings in the given… Read More »

Given a binary array arr[], the task is to find the length of the longest sub-array of the given array such that if the sub-array… Read More »

Given an array arr[] and an integer K, the task is to find the count of pairs (arr[i], arr[j]) from the array such that |arr[i]… Read More »

Given a queue and the task is to sort it using recursion without using any loop. We can only use the following functions of queue:… Read More »

Given an array of N integers, the task is to arrange them in a circular arrangement in such a way that the element is strictly… Read More »

Given an array arr[] of size N and an integer K which means there are N piles of coins and the ith contains arr[i] coins.… Read More »