FunctionRacerProblemsRace

Maximum Product of Three Numbers

EasySorting and searchingPython, JavaScript, TypeScript, Java, C++

Choose three numbers from three different positions of nums so that their product is as large as possible. Return that product.

Negative numbers can help: two negatives multiply to a positive.

Example 1

nums [1,2,3,4]
returns 24

2*3*4 = 24.

Example 2

nums [-10,-10,1,3]
returns 300

(-10)*(-10)*3 = 300.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Sorting and searching problems