Subset Leetcode | In Subset Leetcode problem we have given a set of distinct integers, nums, print all subsets (the read more | |

Dividing Array into Pairs With Sum Divisible by K | The dividing array into pairs with sum divisible by K is a problem which is asked in interviews read more | |

Count Distinct Elements in Every Window of Size K | Subsets are something which we have been dealing with for some time now. In the last episode, we read more | |

Count Subsets Having Distinct Even Numbers | We have all struggled with the subset problem at some point or the other in an interview. The read more | |

Find Three Element From Different Three Arrays Such That a + b + c = sum | Three Sum is a problem loved by interviewers. It is a problem I was personally asked during the read more | |

Longest Increasing Subsequence | We are provided with an array of integers that is unsorted and we have to find the longest read more | |

Count Pairs Whose Products Exist in Array | In count pairs whose products exist in array problem we have given an array, count all the distinct read more | |

Merge Overlapping Intervals | In merge overlapping intervals problem we have given a collection of intervals, merge and return read more | |

Median of Two Sorted Arrays | Given two sorted arrays A and B of size n and m respectively. Find the median of the final sorted read more | |

Maximum Product Subarray | In the maximum product subarray problem, we have given an array of integers, find the contiguous read more | |

Find Maximum of Minimum for Every Window Size in a Given Array | Given an array a[ ] of size n. For every window size that varies from 1 to n in array print or find read more | |

Minimum Size Subarray Sum | Given an array nums of a positive integer and a sum s, find the minimum size of a contiguous read more | |

Intersection of Two Arrays | In intersection of two arrays problem, we have given two arrays, we need to print their read more | |

Leetcode Permutations | In this leetcode problem premutation we have given an array of distinct integers, print all of its read more | |

Search an Element in Sorted Rotated Array | In search in sorted rotated array problem we have given a sorted and rotated array and an element, read more | |

Maximum Product Subarray | Given an array of n integers, find the maximum product obtained from a contiguous subarray of the read more | |

3 Sum | In 3 Sum problem, we have given an array nums of n integers, find all the unique triplets that sum read more | |

Find The Duplicate Number | Given an array nums containing (n + 1) elements and every element is between 1 to n. If there is read more | |

Maximum Sum of 3 Non-Overlapping Subarrays | In the maximum sum of 3 non-overlapping subarrays problem we have given an array nums of positive read more | |

Minimum Index Sum of Two Lists | Ankur and Rishabh are two friends and want to buy some fruits from the market. They both have a read more | |

Split Array Into Consecutive Subsequences | Given a sorted array(in ascending order), check if the array can be split into 1 or more read more | |

Find the Duplicate Element | Given an array of integers of size n+1 where each element of the array is between 1 and n read more | |

Find the Only Repetitive Element Between 1 to N-1 | In finding the only repetitive element between 1 to N-1 problem we have given an array of random read more | |

Trapping Rain Water | In Trapping Rain Water problem we have given N non-negative integers representing an elevation map read more | |

Finding K closest element | In Finding K closest element problem we have given a sorted array and a value x. The problem is to read more | |

Jump Game | In jump game we have given an array of non-negative integers, you are initially positioned at the read more | |

Combination Sum | In combination sum problem we have given an array of positive integers arr[] and a sum s, find all read more | |

Search in Sorted Rotated Array | An element search in sorted rotated array can be found using binary search in O(logn) time. The read more | |

Maximum Subarray | In the Maximum Subarray problem we have given an integer array nums, find the contiguous sub array read more | |

Sliding Window Maximum | In Sliding Window Maximum problem we have given an array nums, for each contiguous window of size read more | |

Delete And Earn | In delete and earn problem we have given an array nums, you may perform the following operation on read more | |

Length of Longest Fibonacci Subsequence | Given a strictly increasing array of positive integers, find the length of the longest fibonacci read more | |

Merging Intervals | In merging intervals problem we have given a set of intervals of the form [l, r], merge the read more | |

First Bad Version | We all have heard the saying “Bad Apple Ruins The Bunch”.First Bad Version is a problem read more | |

Peak Index in a Mountain Array | What is Peak Index in a Mountain Array Problem? An array can be said as a Mountain Array if it read more | |

4Sum | In the 4Sum problem, we have given an integer x and an array a[ ] of size n. Find all the unique read more | |

Create Maximum Number | In the Create Maximum Number problem, we have given two arrays of length n and m with digits 0-9 read more | |

Degree of an array | Problem Statement In the Degree of an array problem we have given a non-empty array of non-negative read more | |

Queue Reconstruction by Height | Problem Description of Queue Reconstruction by Height Suppose you have a random list of people read more | |

Search Insert Position | In the Search Insert Position problem, we have given an integer x and a sorted array a[ ] of size read more | |

Find Peak Element | Let’s understand Find Peak Element problem. Today we have with us an array that needs its read more | |

Valid Triangle Number | Problem In the Valid Triangle Number problem, we have given an array of non-negative integers. read more | |

Power of Two | In Power of Two problem we have given an integer, check if it is the power of 2 or not. A number in read more | |

Stone Game LeetCode | What is Stone Game problem? Stone Game LeetCode – Two players A and B are playing a stone read more | |

Maximum size subarray sum equals k | In Maximum size subarray sum equals k we have given an array of integers and a value k. You have to read more | |

Next greater element | The next greater element is a problem in which we have given an array. This array containing N read more | |

Guess The Word | Guess The Word is an interactive problem. An interactive problem means the data which is given to read more | |

Missing Number | In Missing Number problem we have given an array of size N containing a number from 0 to N. All the read more | |

Merge Sorted Array | In merge sorted array problem we have given two sorted arrays in increasing order. In input first, read more | |

Partition Equal Subset Sum | Partition Equal Subset Sum is a problem in which we have given an array of positive numbers. We read more | |

Last Stone Weight | Last Stone Weight is a problem in which we have a set of stones having some positive weights. Now read more | |

Sort Colors | Sort colors is a problem in which we have to given an array containing N objects. Each box is read more | |

Rotate Array | Rotate array is a problem in which we have given an array of size N. We have to rotate the array in read more | |

Subarray Sum Equals k | Given an integer array and an integer k. Find total number of contiguous subarrays of given array read more | |

Infix to Postfix | What is an infix expression? Expression in the form of ‘operand’ ‘operator’ ‘operand’ read more | |

Circular Queue | A circular queue is an advanced form of a linear queue. In the linear queue, we can’t insert an read more | |

Given a sorted array and a number x, find the pair in array whose sum is closest to x | ALGORITHM TIME COMPLEXITY: O(N) SPACE COMPLEXITY: O(1) 1. We initialize two pointer like variable read more | |

Find the subarray whose sum is equal to a given number X | Example INPUT 7, 3, 18, 2 and given number X = 23 OUTPUT SUBARRAY IS 3, 18, 2 whose sum is 23 read more | |

Arrange Even and Odd number such that Odd comes after Even | INPUT: 7 2 4 9 10 11 13 27 OUTPUT: 10 2 4 9 7 11 13 27 ALGORITHM TIME read more | |

Minimum number of Merge Operations to make an Array Palindrome | If it is not a palindrome it will make merge operations and prints the number of merge operations. read more | |

Form minimum number from given sequence of D’s and I’s | Example 1 INPUT : DIDI OUTPUT : 21435 Example 2 INPUT : DIDII OUTPUT : 214356 In example 1, the read more | |

Longest span with same sum in two binary arrays | Given two binary arrays, array1 and array2 with same size. This function will print the longest read more | |

Find the Subarray of given length with Least Average | Given an array and an input integer X, write a program to find the subarray of length X with read more | |

Find Zeros to be Flipped so that number of Consecutive 1’s is maximized | Given a binary array and number of zeros to be flipped, write a program to find the zeros that read more | |

Merge K Sorted Arrays and Print Sorted Output | Given k sorted arrays of size n each, write a program to merge those arrays and prints the sorted read more | |

Find the minimum element in a sorted and rotated array | Given a sorted array which is rotated at some unknown point, find the minimum element in that array read more | |

Find the point where a monotonically increasing function becomes positive first time | Given a function ‘int f(unsigned int x)’ which takes a non-negative integer read more | |

Print all possible combinations of r elements in a given array of size n | Given an array of size n, find all combinations of size r in the array. Example INPUT: arr[] = read more | |

Sort Elements by frequency | Given an array, Sort the array according to the frequency of the elements Example INPUT: arr[] = read more | |

Stock Buy Sell to Maximize Profit | Given an array which contains stock price on each day, find the maximum profit that you can make by read more | |

Merge Overlapping Intervals | Given a set of intervals, this function will merge the overlapping intervals into one and prints read more | |

Maximum Subarray Sum using Divide and Conquer | Given an array of both positive and negative integers, this function will find the largest sum of read more | |

Pancake sorting Problem | This problem is based on pancake sorting. Given an unsorted array, we need to write a function read more | |

Pancake sorting | Given an unsorted array, this function uses only flip operation to sort the array. flip is the read more | |

Arrange given numbers to form the biggest number | Given an array of positive integers, this function will arrange them in such way that the read more | |

Iterative Implementation of quick sort | Given an array, this function will sort the array using quick sort. Here, quick sort is not read more | |

Shuffle a given array | Given an array of integers, this function will shuffle the given array. That is, it will shuffle read more | |

Find the row with maximum number of 1’s | Given a matrix(2D array) containing binary digits with each row sorted, this function will find the read more | |

Sorting a k sorted array | k sorted array: An array in which each element is at max k away from its position in the sorted read more | |

Maximum product subarray | Given an array consisting of positive, negative integers and also zeroes, this function will find read more | |

Largest subarray with equal number of 0’s and 1’s | Given an array, this function will find the largest subarray with equal number of 0’s and read more | |

Find the two numbers with odd occurrences in an unsorted array | Given an unsorted array in which other than two numbers all other numbers occur even number of read more | |

Maximum sum increasing subsequence | Given an array, this function will find the sum of maximum subsequence of the given array, that is read more | |

Implement two stacks in an array | Implementing two stacks in an array such that, if user wants to push an element in either of two read more | |

Number of smaller elements on right side | Given an array, this function will print the number of smaller elements that are on the right side read more | |

Increasing subsequence of length three with maximum product | In the given array of positive integers, find the subsequence of length 3 with maximum product read more | |

Elements appear more than n/k times in array | In the given array of size n, find the elements which appear more than n/k times. Where k is the read more | |

Find the Peak element from an array | In the given input array of integers find a peak element In an array an element is a peak element, read more | |

Rearrange positive and negative numbers alternatively in Array | In the given random array with both positive and negative integers, rearrange the array so that read more | |

Find the maximum repeating number in array | In the given unsorted array of size N. Given array contains numbers in range {0, k} where k <= read more | |

Hard | Tug of War | In tug of war problem, we have given an array of integers, divide the array into two subsets of read more |

First Circular Tour to Visit all the Petrol Bunks | In the first circular tour to visit all the petrol bunks problem the statement is such that there read more | |

Easy | Count Possible Triangles | In count possible triangles problem we have given an array of n positive integers. Find the number read more |

Medium | Maximum Circular Subarray Sum | In the maximum circular subarray sum problem, we have given an array of integers arranged in a read more |

Medium | Four Elements that Sum to Given | In four elements that sum to a given problem, we have given an array containing N elements that may read more |

Hard | Maximum Length of Chain Pairs | In the maximum length of chain pairs problem we have given n pairs of numbers, find the longest read more |

Find Pair with Given Difference | In the given unsorted array, find the pair of elements in the given array with given difference n. read more | |

Hard | Partition Problem | In the Partition problem, we have given a set that contains n elements. Find whether the given set read more |

The Celebrity Problem | In the celebrity problem there is a room of N people, Find the celebrity. Conditions for Celebrity read more | |

Medium | Find a Sorted Subsequence of size 3 | In the given unsorted array of integers. We need to find a sorted subsequence of size 3. Let three read more |

# Array Interview Questions

I am presenting a collection of commonly asked array interview questions. Array questions are the most asked questions these days. The interviewer wants to know, how efficient code you can write. Therefore practice technical questions on arrays.

These array practice questions will help you clear the difficult programming rounds. In other words, these rounds are based on array questions. But, you should practice it frequently. For example, you can practice 2 questions daily.

Below are the collections of array questions which will help you to practice questions on arrays. Practicing daily will help you to improve your programming logic to solve any new questions you will face.

Array interview questions will help you to clear at-least the first round of the technical interviews.

When you are working on array practice questions then keep one thing in mind to first solve the array questions without seeing the solution. After that, you can match how we have solved the question.