Given an array arr[] of size N, the task is to find the minimum difference between the maximum and the minimum subarray sum when the… Read More

# Tag Archives: two-pointer-algorithm

Given a stack of M elements and a queue of N elements in sorted order. The task is to find out the common elements of… Read More

Given a string S of size N consisting of the characters 0, 1 and 2, the task is to find the length of the smallest… Read More

Given a binary string S of length N, the task is to find the longest substring with at most X number of 0’s and Y… Read More

Given an array A[] of N integers. Check if there exist 2 distinct sub-sequences X and Y of the given array, such that the sum… Read More

Given an array A[] of integers whose length is N, (where N is even) the task is to check if A[] can be grouped into… Read More

Given an array A[] of length N, the task is to find the minimum integer to be appended at any end in the array to… Read More

Given an array arr[] having N integers, the task is to find the maximum distance between any two occurrences of even integers. Examples: Input: arr[]… Read More

Given a binary string str, the task is to determine if string str can be converted into a palindrome in K moves. In one move… Read More

Find Binary String of size at most 3N containing at least 2 given strings of size 2N as subsequences

Given three binary strings a, b, and c each having 2*N characters each, the task is to find a string having almost 3*N characters such… Read More

Given a String ph[], the task is to find the absolute difference of consecutive elements and insert the result in between the consecutive elements. By… Read More

Given an array arr[ ] of size N, the task is to find the rank of the remaining element in an array after performing the… Read More

Given N and M number of points on the straight line, denoting the positions of the customers and vendors respectively. Each vendor provides service to… Read More