## Count the number of possible triangles

Given an unsorted array of positive integers. Find the number of triangles that can be formed with three different array elements as three sides of… Read More »

- Make all numbers of an array equal
- Optimal Strategy for a Game | Set 2
- Sliding Window Maximum (Maximum of all subarrays of size k) using stack in O(n) time
- Sum of XOR of all subarrays
- Find k closest numbers in an unsorted array
- Count pairs in array whose sum is divisible by K
- Building Heap from Array
- Amazon Internship Interview Experience
- Program for K Most Recently Used (MRU) Apps
- Merge K sorted arrays | Set 3 ( Using Divide and Conquer Approach )
- Longest subsequence such that adjacent elements have at least one common digit
- k-th missing element in an unsorted array
- Minimum operations required to make all the array elements equal
- Count of pairs (x, y) in an array such that x < y
- Maximum sum such that no two elements are adjacent | Set 2
- Number of unique pairs in an array
- Check if given Preorder, Inorder and Postorder traversals are of same tree | Set 2
- Merge K sorted arrays of different sizes | ( Divide and Conquer Approach )
- Maximum element in a sorted and rotated array
- Length of the longest alternating subarray
- Given two arrays count all pairs whose sum is an odd number
- Minimum elements to be removed such that sum of adjacent elements is always even
- Sort an array without changing position of negative numbers
- Array Manipulation and Sum
- Remove minimum elements from either side such that 2*min becomes more than max | Set 2
- Create linked list from a given array
- Count array elements that divide the sum of all other elements
- Find minimum difference between any two elements | Set 2
- Find two numbers whose divisors are given in a random order
- Maximum absolute difference in an array

Given an unsorted array of positive integers. Find the number of triangles that can be formed with three different array elements as three sides of… Read More »

Given an array where every element occurs three times, except one element which occurs only once. Find the element that occurs once. Expected time complexity… Read More »

Given a boolean 2D array, where each row is sorted. Find the row with the maximum number of 1s. Example: Input matrix 0 1 1… Read More »

Given n numbers (both +ve and -ve), arranged in a circle, fnd the maximum sum of consecutive number. Examples: Input: a[] = {8, -8, 9,… Read More »

Given a number, find the next smallest palindrome larger than this number. For example, if the input number is “2 3 5 4 5”, the… Read More »

Given an array of n elements, where each element is at most k away from its target position, devise an algorithm that sorts in O(n… Read More »

Given an array of integers, find any one combination of four elements in the array whose sum is equal to a given value X. For… Read More »

Given an array of integers, find all combination of four elements in the array whose sum is equal to a given value X. For example,… Read More »

Given an array of integers, replace every element with the next greatest element (greatest element on the right side) in the array. Since there is… Read More »

Given an array that contains both positive and negative integers, find the product of the maximum product subarray. Expected Time complexity is O(n) and only… Read More »

Given an array containing only 0s and 1s, find the largest subarray which contain equal no of 0s and 1s. Expected time complexity is O(n).… Read More »

Given an array of n integers, find the 3 elements such that a[i] < a[j] < a[k] and i < j < k in 0(n)… Read More »

Given an unsorted array that contains even number of occurrences for all numbers except two numbers. Find the two numbers which have odd occurrences in… Read More »

You are given an unsorted array with both positive and negative elements. You have to find the smallest positive number missing from the array in… Read More »

Given an array and a value, find if there is a triplet in array whose sum is equal to the given value. If there is… Read More »