Skip to content

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 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

Start Your Coding Journey Now!