Sunteți pe pagina 1din 16

two pointer

hashing

partition

partition

partition

merge sort method


two pointer

two arrays

prefix sum
sliding window

other

tough

tough
another method hash

Kadane & similar


Given an array A[] and a number x, check for pair in A[] with s
Find four elements that sum to a given value | Set 2
Solution)
Count pairs with given sum
Pair with given product | Set 1
Print all subarrays with 0 sum

Merge an array of size n into another array of size m+n


Two elements whose sum is closest to zero
Segregate 0s and 1s in an array
Union and Intersection of two sorted arrays
Segregate Even and Odd numbers
Find a triplet that sum to a given value
Count the number of possible triangles
Rearrange positive and negative numbers in O(n) time a
space
Maximum Sum Path in Two Arrays
Find common elements in three sorted arrays
Given a sorted array and a number x, find the pair in array
closest to x
Pythagorean Triplet in an array
Check if a sorted array can be divided in pairs whose sum is
Count triplets with sum smaller than a given value
Rearrange array in alternating positive & negative items w
space | Set 2
Absolute distinct count in a sorted array
Find all triplets in a sorted array that forms Geometric Progre
Reverse an array in groups of given size

Maximum Length Bitonic Subarray | Set 1 (O(n) tine and O(n


Given an array arr[], find the maximum j i such that arr[j] > a
Find a sorted subsequence of size 3 in linear time
Find the Increasing subsequence of length three with maximu
Trapping Rain Water

Largest subarray with equal number of 0s and 1s


Longest Span with same Sum in two Binary arrays
Find number of subarrays with even sum
Smallest subarray with sum greater than a given value
Find subarray with given sum | Set 1 (Nonnegative Numbers
Find maximum average subarray of k length
Find zeroes to be flipped so that number of consecutive 1s is
Find the subarray with least average
Count pairs formed by distinct element sub-arrays
Largest product of a subarray of size k

Maximum sum such that no two elements are adjacent


Sort elements by frequency | Set 1
k largest(or smallest) elements in an array | added Min Heap
Longest Monotonically Increasing Subsequence Size (N log N
Find the smallest positive integer value that cannot be repres
of any subset of a given array
Sum of absolute differences of all pairs in a given array
Maximum difference between two elements such that la
appears after the smaller number
Find subarray with given sum | Set 1 (Nonnegative Numbers
Maximum Product Subarray
Maximum circular subarray sum
Stock Buy Sell to Maximize Profit
Length of the largest subarray with contiguous elements | Se
Find Index of 0 to be replaced with 1 to get longest continu
of 1s in a binary array
Find maximum value of Sum( i*arr[i]) with only rotations o
allowed
Maximum Product Subarray | Set 2 (Using Two Traversals)
Maximize number of 0s by flipping a subarray
see comments for o(n)

see comments for o(n)

see comments for better


specific tri

easy
inversion

binary sea

xor
Majority Element
Leaders in an array
A Product Array Puzzle
Find the smallest and second smallest elements in an array
Find duplicates in O(n) time and O(1) extra space | Set 1
Check if array elements are consecutive | Added Method 3
Find the minimum distance between two numbers
Find the smallest positive number missing from an unsorted
Set 1
Arrange given numbers to form the biggest number
Merge Overlapping Intervals
Find the maximum repeating number in O(n) time and O(1
space
Count all possible groups of size 2 or 3 that have sum as mu
3
Given a binary string, count number of substrings that start a
with 1
Count frequencies of all elements in array in O(1) extra spa
O(n) time
Convert array into Zig-Zag fashion
Count Inversions of size three in a given array
Merge two sorted arrays with O(1) extra space
Count Strictly Increasing Subarrays
Rearrange an array in maximum minimum form | Set 1
Minimize the maximum difference between the heights
Maximum product of a triplet (subsequnece of size 3) in array
Find Surpasser Count of each element in array
Find if array can be divided into two subarrays of equal sum
Find Two Missing Numbers | Set 1 (An Interesting Linea
Solution)

Search an element in a sorted and rotated array


Check for Majority Element in a sorted array
Find the smallest missing number

Find the Number Occurring Odd Number of Times


Find the two repeating elements in a given array
Find the two numbers with odd occurrences in an unsorted a
Find lost element from a duplicated array
scan from right
basic
Write a program to reverse an array or string
Program for array rotation
Reversal algorithm for array rotation
Minimum sum of two numbers formed from digits of
an array

S-ar putea să vă placă și