# Tag Archives: two-pointer-algorithm

Given binary string str containing only 0 and 1, the task is to find the number of sub-strings containing only 1s and 0s respectively, i.eâ€¦ Read More
Given an array arr[] and an integer K, that task is to choose at most K elements of the array and replace it by anyâ€¦ Read More
Given an integer N, the task is to count the number of pairs among the first N natural numbers, with sum equal to N. Examples:â€¦ Read More
Given an array arr[] of length N and an integer K, the task is to find the longest subarray with difference between any two distinctâ€¦ Read More
Given a string str consisting of lowercase alphabets, the task is to find the number of possible substrings (not necessarily distinct) that consists of distinctâ€¦ Read More
Given an array arr[] and a target value K. The task is to find the minimum number of steps required to take all elements fromâ€¦ Read More
Given an array arr[] having N integers and an integer K, the task is to select K elements from the given array such that theâ€¦ Read More
Given an array arr[] of N positive integers which denotes the cost of selling and buying a stock on each of the N days. Theâ€¦ Read More
Given string str, the task is to check if characters at the odd indexes of str form a palindrome string or not. If not thenâ€¦ Read More
Given string str, the task is to check if characters at the odd indexes of str form a palindrome string or not. If not thenâ€¦ Read More
Given an array arr[] of length N with unique elements, the task is to find the length of the longest increasing subsequence that can beâ€¦ Read More
Given a N-ary tree with some colour associated with every node and Q queries. Each query contains two integers A and X. The task isâ€¦ Read More
Given two 2-D arrays which represent intervals. Each 2-D array represents a list of intervals. Each list of intervals is disjoint and sorted in increasingâ€¦ Read More
Given an integer array arr[] and an integer K, the task is to find the number of non-empty subsets S such that min(S) + max(S)â€¦ Read More
Given string str consisting of only lowercase English alphabets, the task is to find the substring of the smallest length which contains all the vowels.â€¦ Read More