Arrays

May 18, 2021

Array problems are many and can be some of the trickiest in the business. There are many problems that seek the maximum or minimum value of subarrays and subsequences and there could be many ways to solve a problem. Problems with arrays can be solved with Dynamic Programming, Two Pointers, Sliding Window or using a data structure such as a Hash Map or a Heap. Below are some problems categorized by problem solving strategy.

ProblemStrategyDescription
Maximum Size Subarray Sum Equals KHashMapFind maximum length subarray whose sum equals to K.
Subarray Sum Equals KHashMapFind total number of subarrays whose sum equals to K.
Contiguous ArrayHashMapFind maximum length subarray with equal numbers of 1's and 0's.
Maximum Product SubarrayVisualizeFind largest product of any subarray.
Maximum SubarrayVisualizeFind largest sum of any subarray.
Maximum Product of Three NumbersVisualizeFind maximum product of three numbers in array.