Maximum Product of Three Numbers

Easy · Arrays & Strings · about 10 minutes

Asked at Salesforce, Amazon, Microsoft, Bloomberg, Google, Okta, HubSpot, SAP.

nums has at least three values, possibly negative. Choose three of them (from different positions) to make their product as large as possible, and return that product. It fits in a signed 32-bit integer.