# Tag Archives: two-pointer-algorithm

Given two arrays consisting of N distinct integers such that the array A[] and B[] are sorted in ascending and descending order respectively, the task… Read More
Given an array arr[] of size N consisting of 0, 1, 2, and 3 only, the task is to sort the given array in ascending… Read More
Given an array arr[] of size N, the task is to rearrange the array elements such that all the Prime numbers are placed before the… Read More
Given a string S consisting of N characters and a positive integer K, the task is to count the number of substrings having at least… Read More
Given an array arr[] consisting of N integers, the task is to find the length of the smallest subarray required to be removed to make… Read More
Given a string S of length N consisting only of characters ‘a’, ‘b’, and ‘c’, the task is to minimize the length of the given… Read More
Given an array arr[] consisting of N integers, the task is to check if the sequence of numbers formed by repeatedly removing the middle elements… Read More
Given a binary string S and an array A[], both of size N, the task is to find the maximum score possible by removing substrings… Read More
Given a Linked List and two integers X and Y, the task is to remove all occurrences of Y after the first occurrence of a… Read More
Given an array arr[] of size N, the task is to count the number of pairs (arr[i], arr[j]) such that |arr[i]| and |arr[j]| lies between… Read More
Given two sorted strings S1 and S2 of lengths N and M respectively, the task is to construct lexicographically the smallest string possible by merging… Read More
Given an array nums[] and an integer X, the task is to reduce X to 0 by removing either the leftmost or the rightmost array… Read More
Given a singly Linked List and an integer K denoting the position of a Linked List, the task is to delete the Kth node from… Read More
Given a positive integer K and two arrays A[] and B[] consisting of M and N positive integers from the range [1, K] respectively, the… Read More
Given an array arr[] consisting of N integers, the task is to print the indices of two array elements required to be removed such that… Read More