## Longest alternative parity subsequence

Given an array a of size N. The task is to print the length of the longest alternative odd/even or even/odd subsequence. Examples: Input: a[]… Read More »

- Optimal Strategy for a Game | Set 2
- Sliding Window Maximum (Maximum of all subarrays of size k) using stack in O(n) time
- Count pairs in array whose sum is divisible by K
- Find k closest numbers in an unsorted array
- Building Heap from Array
- Amazon Internship Interview Experience
- Check if given Preorder, Inorder and Postorder traversals are of same tree | Set 2
- Maximum sum such that no two elements are adjacent | Set 2
- Longest subsequence such that adjacent elements have at least one common digit
- Sort an array without changing position of negative numbers
- Create linked list from a given array
- Maximum element in a sorted and rotated array
- Given two arrays count all pairs whose sum is an odd number
- Find maximum xor of k elements in an array
- Partition an array of non-negative integers into two subsets such that average of both the subsets is equal
- Maximum absolute difference in an array
- Find the longest string that can be made up of other strings from the array
- Program to check if an Array is Palindrome or not
- Find minimum difference between any two elements | Set 2
- Remove minimum elements from either side such that 2*min becomes more than max | Set 2
- Kth smallest element in a subarray
- Count the triplets such that A[i] < B[j] < C[k]
- Introduction to Data Structures | 10 most commonly used Data Structures
- Number of subsets with zero sum
- Count of integers of length N and value less than K such that they contain digits only from the given set
- Maximum sum combination from two arrays
- Find m-th smallest value in k sorted arrays
- Minimum cost to reach end of array array when a maximum jump of K index is allowed
- Find the minimum number of operations required to make all array elements equal
- Maximum Sum Subsequence of length k

Given an array a of size N. The task is to print the length of the longest alternative odd/even or even/odd subsequence. Examples: Input: a[]… Read More »

Given an array of N integers. The task is to find the lexicographically smallest array possible by applying the given operation any number of times.… Read More »

Given an array a of size N. The task is to find a subsequence X of length K such that gcd(X[0], X[1]) + (X[2], X[3])… Read More »

Given an array arr[] of N integers. The task is to find the largest elements in the first half and the second half of the… Read More »

Given an array of integers arr[], the task is to print a list of all the peaks and another list of all the troughs present… Read More »

Given an array arr[] of integers, the task is to find the sum of even elements from the array. Examples: Input: arr[] = {1, 2,… Read More »

Given two arrays X and L of same size N. Xi represents the position in an infinite line. Li represents the range up to which… Read More »

Given an array a of size N and an integer K. The task is to find the maximum bitwise and value of elements of any… Read More »

Given an array a[] of size N. The value of a subset is the product of primes in that subset. A non-prime is considered to… Read More »

Given an array A of size N (> 2). The task is to find the maximum value of A[i] / A[j] Note: A[i] ≠ 0.… Read More »

Given an array arr of size N and an integer X. The task is to find all the indices of the integer X in the… Read More »

Given an array arr[] of N integers such that any two adjacent elements in the array differ at only one position in their binary representation.… Read More »

Given an array arr[] of size N, the task is to perform the following operation exactly N times, Create an empty list of integers b[]… Read More »

Given an array arr[] of integers, the task is to find all possible ways the array could be split into two subsequences such that the… Read More »

Given an array arr[] of size N (N > 2). The task is to find lexicographically largest permutation of the array such that arr[i] =… Read More »