Skip to content

Tag Archives: two-pointer-algorithm

Given an array of size N containing all elements as 0 initially, and a Q queries containing range in the form of [L, R]. The… Read More
Given an array arr[] of N elements, the task is to find the length of the smallest subarray such that when this subarray is removed… Read More
Set 1: Sliding Window Maximum (Maximum of all subarrays of size k).Given an array arr of size N and an integer K, the task is… Read More
Given an array arr of integers of size N and a target number, the task is to find all unique quadruplets in it, whose sum… Read More
Given a sorted array arr of size N, the task is to reduce the array such that each element can appear at most two times.… Read More
Given an integer K and a binary string S of length N, the task is to find out the number of substrings whose decimal equivalent… Read More
There are two singly linked lists in a system. By some programming error, the end node of one of the linked lists got linked to… Read More
Given an array arr[] with N distinct numbers and another array arr1[] with N-1 operators (either < or >), the task is to organize the… Read More
Given a string str, the task is to replace all occurrences of the given X with given Y and also remove any occurrences of the… Read More
Given an array arr[] consisting of N elements, the task is to remove minimum number of elements from the ends of the array such that… Read More
Given a binary string S of length N and an integer K, the task is to find the smallest non-zero sub-string of S that can… Read More
Given two strings X and Y containing lower-case alphabets, the task is to check whether any permutation of string X exists in Y as its… Read More
Given an array arr[] of N elements and an integer K, the task is to find the number of non-decreasing sub-arrays of length less than… Read More
Given an array arr[] of N elements and an integer K, the task is to find the number of non-decreasing sub-arrays of length greater than… Read More
Given an array arr[] of length N, the task is to find the number of non-decreasing sub-arrays of length K.Examples:   Input: arr[] = {1, 2,… Read More

Start Your Coding Journey Now!