List of 50+ Array Coding Interview Problems
In this article, we have listed important Problems on Array which you must practice for Coding Interviews and listed introductory and background topics on Array as well. You must bookmark this page and practice all problems listed.
Table of Contents:
- Basics of Array (+ Implementation)
- Types of Array
- Coding Problems on Array
(Important)
Basics of Array (+ Implementation)
Array is a simple Data Structure. Go through the basics of Array and how to implement it in C and C++ Programming Language. This is same for other programming Languages as well. We will attempt Practice Problems following this.
- Array
- Row major and Column major order
- Get length of array in C and C++
- Initialize array in C
- Delete an array in C
- 2D array in C
(Important)
- 3D array in C
- Intersection of two arrays
- Time Complexity Analysis of Array
Types of Array
Many do not realize that there are different types of Array. Each type is useful for different problems. Some array techniques like Prefix Sum Array will help you solve key Algorithmic Problems.
Go through the different types of Array:
- Dynamic Array
(Important)
- Time Complexity of Dynamic Array
- Hashed Array Tree: Efficient representation of Array
(Important)
- Suffix Array
- Prefix Sum Array
(Important)
- Bit Array
(Important)
- Bit Mask/ Map
- Array vs Linked List
Core Techniques of Array
Array is a simple Data Structure but Algorithmic Problems based on array can be challenging to solve efficiently if you are not in practice.
Practice these Coding Problems based on Array:
- Least frequent element in an array
- Largest element in array
- Smallest element in array
- K-th largest element in array stream
- Techniques to find Peak element in array
Array Rotation
Array Rotation (3 techniques) (Important)
- Block swap algorithm for array rotation
- Reversal algorithm for array rotation
- Juggling algorithm for array rotation
Partition
Partition an Array (2 techniques) (Important)
Majority Element
- Techniques to find Majority element
- General techniques
- Boyer Moore majority vote algorithm: A very important algorithm for Competitive Programming.
Practice Problems on Array
- Shuffle an array
(Important)
- Finding 2 elements with difference k in a sorted array
(Important)
- Finding LCM of an array of numbers
- Find GCD of all elements in an array
- Find index such that sum of left sub-array = right sub-array (Equilibrium Index)
(Important)
- Multiple array range increments in linear time O(N)
- String Matching using Bitset
(Important)
- Pass array in function in C in two ways
- Implement 1 Stack in an array
- Implementing two stacks in one array
(Important)
- Implementing K stacks in one array
- Move negative elements to front of array
- Queue using array
- Converting a Sorted Array to Binary Tree
- Minimum Increment and Decrement operations to make array elements equal
- Minimum number of increment (by 1) operations to make elements of an array unique
- Kadane's Algorithm for largest subarray sum
- Minimum number of operations to make GCD of an array K
(Important)
- Minimum number of increment or decrement (by 1) operations to make array in increasing order
- Minimum number of increment (by 1) operations to make array in increasing order
- Smallest Missing Positive Integer
- Set Matrix elements to Zeros
- Make N numbers equal by incrementing N-1 numbers
- Rolling Hash
(Important)
- Maximize the sum of array_i * i
- Find Minimum sum of product of two arrays
- The smallest subset with sum greater than sum of all other elements
- Find the Largest lexicographic array with at most K consecutive swaps
- String Matching using Bitset
- Minimum Product Subset of an array
(Important)
- Maximum Product Subset of an array
- Multiple array range increments in linear time O(N)
- Minimum operations to make GCD of array a multiple of k
- Maximize sum of consecutive differences in a circular array
- 3 Sum Problem
- Closest 3 Sum problem
- Array Interview Questions MCQs
With this article at OpenGenus, you must a strong idea and practice of Array based Problems. Best of Luck with your Interviews and Research.