DataStructuresAlgorithms
500+ Data Structures and Algorithms practice problems
Install / Use
/learn @bollwarm/DataStructuresAlgorithmsREADME
500+ Data Structures and Algorithms practice problems
Array
1.Find pair with given sum in the array
2.Check if subarray with 0 sum is exists or not
3.Print all sub-arrays with 0 sum
4.Sort binary array in linear time
5.Find a duplicate element in a limited range array
6.Find largest sub-array formed by consecutive integers
7.Find maximum length sub-array having given sum
8.Find maximum length sub-array having equal number of 0’s and 1’s
9.Sort an array containing 0’s, 1’s and 2’s (Dutch national flag problem)
10.Inplace merge two sorted arrays
11.Merge two arrays by satisfying given constraints
12.Find index of 0 to replaced to get maximum length sequence of continuous ones
13.Find maximum product of two integers in an array
14.Shuffle a given array of elements (Fisher–Yates shuffle)
15.Rearrange the array with alternate high and low elements
16.Find equilibrium index of an array
17.Find majority element in an array (Boyer–Moore majority vote algorithm)
18.Move all zeros present in the array to the end
19.Replace each element of array with product of every other element without using / operator
20.Find Longest Bitonic Subarray in an array
21.Find maximum difference between two elements in the array by satisfying given constraints
22.Maximum subarray problem (Kadane’s algorithm)
23.Print continuous subarray with maximum sum
24.Maximum Sum Circular Subarray
25.Find all distinct combinations of given length
26.Find all distinct combinations of given length with repetition allowed
27.Find maximum sequence of continuous 1’s formed by replacing at-most k zeroes by ones
28.Find minimum sum subarray of given size k
29.Find subarray having given sum in given array of integers
30.Find the length of smallest subarray whose sum of elements is greater than the given number
31.Find largest number possible from set of given numbers
32.Find the smallest window in array sorting which will make the entire array sorted
33.Find maximum sum path involving elements of given arrays
34.Maximum profit earned by buying and selling shares any number of times
35.Trapping Rain Water within given set of bars
36.Longest Increasing Subsequence
37.Longest Decreasing Subsequence Problem
38.Find maximum product subarray in a given array
39.Find maximum sum of subsequence with no adjacent elements
40.Find minimum platforms needed in the station so to avoid any delay in arrival of any train
41.Decode the array constructed from another array
42.Sort an array using one swap
43.Find Triplet with given sum in an array
44.Length of longest continuous sequence with same sum in given binary arrays
45.Rearrange array such that A[A[i]] is set to i for every element A[i]
46.Reverse every consecutive m elements of the given subarray
47.Maximum Product Subset Problem
48.Find pairs with given difference k in the array
49.Find pairs with given difference k in the array | Constant space solution
50.4 sum problem | Quadruplets with given sum
51.Print all quadruplets with given sum | 4-sum problem extended
52.Find odd occurring element in an array in single traversal
53.Find two odd occurring element in an array without using any extra space
55.Print all Triplets that forms Arithmetic Progression
56.Print all triplets that forms Geometric Progression
57.Print all combination of numbers from 1 to n having sum n
58.Replace each element of the array by its corresponding rank in the array
59.Print all Triplets in an array with sum less than or equal to given number
60.Group elements of an array based on their first occurrence
61.Find minimum difference between index of two given elements present in the array
62.Find maximum absolute difference between sum of two non-overlapping sub-arrays
63.Find all Symmetric Pairs in an Array of Pairs
64.Partition an array into two sub-arrays with the same sum
65.Find count of distinct elements in every sub-array of size k
66.Find two numbers with maximum sum formed by array digits
67.Print all sub-arrays of an array having distinct elements
68.Find a Triplet having Maximum Product in an Array
69.Find ways to calculate a target from elements of specified array
70.Find Minimum Index of Repeating Element in an Array
71.Generate Random Input from an Array according to given Probabilities
[72.Find pair in an array having minimum absolute sum](http://www.techiedelight.com/find-
Security Score
Audited on Mar 24, 2026
