An **array** is a data structure consisting of a collection of elements (values or variables), each identified by at least one array index or key. The simplest type of data structure is a linear array, also called one-dimensional array.

Arrays are among the oldest and most important data structures, and are used by almost every program. They are also used to implement many other data structures, such as lists, heaps, hash tables, deques, queues, stacks, strings.

In this post, we have list out commonly asked interview questions that uses array data structure –

- Find pair with given sum in the array

- Check if subarray with 0 sum is exists or not

- Print all sub-arrays with 0 sum

- Sort binary array in linear time

- Find a duplicate element in a limited range array

- Find largest sub-array formed by consecutive integers

- Find maximum length sub-array having given sum

- Find maximum length sub-array having equal number of 0’s and 1’s

- Sort an array containing 0’s, 1’s and 2’s (Dutch national flag problem)

- Inplace merge two sorted arrays

- Merge two arrays by satisfying given constraints

- Find index of 0 to replace to get maximum length sequence of continuous ones

- Find maximum product of two integers in an array

- Shuffle a given array of elements (Fisher–Yates shuffle)

- Rearrange the array with alternate high and low elements

- Find equilibrium index of an array

- Find majority element in an array (Boyer–Moore majority vote algorithm)

- Move all zeros present in the array to the end

- Replace each element of array with product of every other element without using / operator

- Find Longest Bitonic Subarray in an array

- Find maximum difference between two elements in the array by satisfying given constraints

- Maximum subarray problem (Kadane’s algorithm)

- Print continuous subarray with maximum sum

- Maximum Sum Circular Subarray

- Find all distinct combinations of given length

- Find all distinct combinations of given length with repetition allowed

- Find maximum sequence of continuous 1’s formed by replacing at-most k zeroes by ones

- Find minimum sum subarray of given size k

- Find subarray having given sum in given array of integers

- Find the length of smallest subarray whose sum of elements is greater than the given number

- Find largest number possible from set of given numbers

- Find the smallest window in array sorting which will make the entire array sorted

- Find maximum sum path involving elements of given arrays

- Maximum profit earned by buying and selling shares any number of times

- Trapping Rain Water within given set of bars

- Longest Increasing Subsequence

- Longest Decreasing Subsequence Problem

- Find maximum product subarray in a given array

- Find maximum sum of subsequence with no adjacent elements

- Find minimum platforms needed in the station so to avoid any delay in arrival of any train

- Decode the array constructed from another array

- Sort an array using one swap

- Find Triplet with given sum in an array

- Length of longest continuous sequence with same sum in given binary arrays

- Rearrange array such that A[A[i]] is set to i for every element A[i]

- Reverse every consecutive m elements of the given subarray

- Maximum Product Subset Problem

- Find pairs with given difference k in the array

- Find pairs with given difference k in the array | Constant space solution

- 4 sum problem | Quadruplets with given sum

- Print all quadruplets with given sum | 4-sum problem extended

- Find odd occurring element in an array in single traversal

- Find two odd occurring element in an array without using any extra space

- Quickselect Algorithm

- Print all Triplets that forms Arithmetic Progression

- Print all triplets that forms Geometric Progression

- Print all combination of numbers from 1 to n having sum n

- Replace each element of the array by its corresponding rank in the array

- Print all Triplets in an array with sum less than or equal to given number

- Group elements of an array based on their first occurrence

- Find minimum difference between index of two given elements present in the array

- Find maximum absolute difference between sum of two non-overlapping sub-arrays

- Find all Symmetric Pairs in an Array of Pairs

- Partition an array into two sub-arrays with the same sum

- Find count of distinct elements in every sub-array of size k

- Find two numbers with maximum sum formed by array digits

- Print all sub-arrays of an array having distinct elements

- Find a Triplet having Maximum Product in an Array

- Find ways to calculate a target from elements of specified array

- Find Minimum Index of Repeating Element in an Array

- Generate Random Input from an Array according to given Probabilities

- Find pair in an array having minimum absolute sum

- Find Index of Maximum Occurring Element with Equal Probability

- Check if an Array is Formed by Consecutive Integers

- Find two non-overlapping pairs having same sum in an array

- Find Minimum Product among all Combinations of Triplets in an Array

- Replace every element of an array with the least greater element on its right

- Find all odd occurring elements in an array having limited range of elements

- Add elements of two arrays into a new array

- Count the distinct absolute values in the sorted array

- Print all combinations of positive integers in increasing order that sum to a given number

- Find all distinct combinations of given length – Part 2

- Find subarrays with given sum in an array

- Find the surpasser count for each element of an array

- Find maximum length sequence of continuous ones (Using Sliding Window)

- Find maximum length sequence of continuous ones

- Calculate frequency of all elements present in an array of specified range in linear time and using constant space

- Rearrange the array such that it contains positive and negative numbers at alternate positions

- Merging Overlapping Intervals

- Activity Selection Problem

- Job Sequencing Problem with Deadlines

- Introduction to Priority Queues using Binary Heaps

- Min Heap and Max Heap Implementation in C++

- Min Heap and Max Heap Implementation in Java

- Heap Sort (Out-of-place and In-place implementation in C++ and C)

- Check if given array represents min heap or not

- Convert Max Heap to Min Heap in linear time

- Find K’th largest element in an array

- Sort a K-Sorted Array

- Merge M sorted lists of variable length

- Find K’th smallest element in an array

- Find smallest range with at-least one element from each of the given lists

- Merge M sorted lists each containing N elements

- Insertion sort | Iterative & Recursive

- Selection sort | Iterative & Recursive

- Bubble sort | Iterative & Recursive

- Merge Sort

- Quicksort

- Iterative Implementation of Quicksort

- Hybrid QuickSort

- Quicksort using Dutch National Flag Algorithm

- Quick Sort using Hoare’s Partitioning scheme

- External merge sort

- Custom Sort | Sort elements by their frequency and Index

- Custom Sort | Sort elements of the array by order of elements defined by the second array

- Inversion Count of an array

- Segregate positive and negative integers in linear time

- Binary Search

- Ternary Search vs Binary search

- Interpolation search

- Exponential search

- Find number of rotations in a circularly sorted array

- Search an element in a circular sorted array

- Find first or last occurrence of a given number in a sorted array

- Count occurrences of a number in a sorted array with duplicates

- Find smallest missing element from a sorted array

- Find Floor and Ceil of a number in a sorted array

- Search in a nearly sorted array in O(log(n)) time

- Find number of 1’s in a sorted binary array

- Find the peak element in an array

- Maximum Sum Subarray using Divide & Conquer

- Find Minimum and Maximum element in an array using minimum comparisons

- Matrix Chain Multiplication

- 0-1 Knapsack problem

- Maximize value of the expression

- Partition problem

- Subset sum problem

- Minimum Sum Partition problem

- Rod Cutting

- Coin change-making problem (unlimited supply of coins)

- Coin Change Problem (Total number of ways to get the denomination of coins)

- Longest alternating subsequence

- Combinations of words formed by replacing given numbers with corresponding alphabets

- Decode the given sequence to construct minimum number without repeated digits

- All combinations of elements satisfying given constraints

- Find Missing Term in a Sequence in log(n) time

- Print all distinct Subsets of a given Set

- Find Floor and Ceil of a number in a sorted array (Recursive solution)

- Set both elements of a binary array to 0 in single line

- K-Partition Problem | Printing all Partitions

- 3 Partition Problem

- 3-partition problem extended | Print all partitions

- Iterative Merge Sort Algorithm (Bottom-up Merge Sort)

- Find two duplicate elements in an limited range array (using XOR)

- Find missing number and duplicate elements in an array

- Find Minimum and Maximum element in an array by doing minimum comparisons

- Find Frequency of each element in a sorted array containing duplicates

- Difference between Subarray, Subsequence and Subset

**Thank you for being with us. 🙂**

## Leave a Reply