Given an array A[] consisting of N integers, the task is to find the maximum possible value of K, such that K * |i –… Read More

# Tag Archives: two-pointer-algorithm

Given two integers N and K, the task is to find the total count of N-digit number such that the sum of every K consecutive… Read More

Given an array A[ ] consisting of N positive integers, the task is to find the number of triplets A[i], A[j] & A[k] in the… Read More

Given an array arr[] of size N, consisting of positive and negative integers, the task is to find the longest alternating subsequence(i.e. the sign of… Read More

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