Maximum Product Subarray

Medium · Dynamic Programming · about 20 minutes

Asked at LinkedIn, Amazon, Bloomberg, Google, Meta, Microsoft, Quora.

Among all non-empty contiguous slices of nums, find the one whose values multiply to the biggest number, and return that product. It fits in 32 bits.

Related guides