Array Coding Questions
Table of Contents + β
Arrays coding questions are most commonly asked in interviews because arrays are one of the most fundamental data structures.
π Basic Array Coding Questions
- Reverse an array
- Find the maximum and minimum element in an array
- Find the sum of all elements in an array
- Find the second largest element in an array
- Check if an array is sorted
- Move all zeros to the end of an array
- Find the intersection of two arrays
- Find the union of two arrays
- Find the missing number in an array of size n containing numbers from 1 to n
- Find the duplicate number in an array of size n+1 containing numbers from 1 to n
- Rotate an array by k positions
- Merge two sorted arrays
- Find the pair of elements in an array that sum to a given value
- Find the longest consecutive subsequence in an array
- Find the majority element in an array
- Find the maximum product subarray
- Find the subarray with the given sum
- Find the equilibrium index of an array
- Find the maximum sum of a contiguous subarray (Kadaneβs Algorithm)
- Find the number of subarrays with a given sum
- Find the length of the longest increasing subsequence in an array
- Find the maximum sum of two non-overlapping subarrays
- Find the smallest missing positive integer in an array
- Find the maximum sum of a circular subarray
- Find the maximum difference between two elements in an array such that the larger element appears after the smaller element
- Find the number of inversions in an array
- Find the next greater element for each element in an array
- Find the previous smaller element for each element in an array
- Find the maximum sum of a subarray with at least k elements
- Find the maximum sum of a subarray with at most k elements
- Find the maximum sum of a subarray with exactly k elements
- Find the maximum sum of a subarray with length between k1 and k2
- Find the maximum sum of a subarray with length at least k
- Find the maximum sum of a subarray with length at most k
- Find the maximum sum of a subarray with length exactly k
- Find the maximum sum of a subarray with length between k1 and k2
- Find the maximum sum of a subarray with length at least k
- Find the maximum sum of a subarray with length at most k
- Find the maximum sum of a subarray with length exactly k
- Find the maximum sum of a subarray with length between k1 and k2