# Tag Archives: two-pointer-algorithm

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
Given an array arr[] of N integers and an integer X, the task is to find three integers in arr[] such that the sum isâ€¦ Read More
Given a Binary Search Tree, and a number X. The task is to find the number of distinct pairs of distinct nodes in BST withâ€¦ Read More
Given an array A of size N. The task is to find the length of smallest subarray which contains both maximum and minimum values. Examples: â€¦ Read More
Given a Binary Search Tree and a SUM. The task is to check if there exists any triplet(group of 3 elements) in the given BSTâ€¦ Read More
Given a sorted doubly linked list of distinct nodes(no two nodes have the same data) and a value x. The task is to count theâ€¦ Read More
Given a sorted integer array and number k, the task is to count pairs in an array whose product is less than x. Examples: Input:â€¦ Read More
Given an array of distinct integers(considering only positive numbers) and a number â€˜mâ€™, find the number of triplets with the product equal to â€˜mâ€™. Examples:â€¦ Read More
Given an array arr[] of positive numbers, find minimum number of sets in array which satisfy following property,  A set can contain maximum two elementsâ€¦ Read More
Given an array of distinct integers and a sum value. Print all triplets with sum smaller than given sum value. Expected Time Complexity is O(n2).â€¦ Read More
Given an array of N numbers where a subarray is sorted in descending order and rest of the numbers in the array are in ascendingâ€¦ Read More
Given two sorted arrays of distinct elements, we need to print those elements from both arrays that are not common. The output should be printedâ€¦ Read More