JavaScript coding interview — Array — Part 3

Sathish Kumar Arumugam
2 min readSep 6, 2020

Array related questions and answers from brute force to better optimal way of achieving Big O

Photo by Ulises Baga on Unsplash

Find the maximum value of an array

Remove duplicate from an array/ unique array

Get duplicates from an array

Flatten the array

Find the median value of an array

Find two sum of an array twoSum(arr, sum)

Maximum consecutive sum of integers in an array

Union of arrays (merge two arrays without duplicates)

Intersection of arrays/ find common values of arrays (multidimensional)

Given an array of integers, every element appears twice except for one. Find that single one

Given an array of integers, find the largest product yielded from three of the integers

Being told that an unsorted array contains (n — 1) of n consecutive numbers (where the bounds are defined), find the missing number in O(n) time

Given an array of integers, find the largest difference between two elements such that the element of lesser value must come before the greater element

Given an array of integers, return an output array such that output[i] is equal to the product of all the elements in the array other than itself. (Solve this in O(n) without division)

DNF problem (An array just contains 1s, 2s, and 3s. Sort the array)

--

--