Largest Product from Array

Welcome to the first of what’s planned to be a weekly series of online coding challenges.

This week is a Java challenge. You’re going to iterate through an array of integers and determine the largest possible product using the array values.


Largest Product

Calculate the largest possible product using any 3 elements from an array of integers.

largestProduct( [1, 2, 3] ) => 6
largestProduct( [0, 0, 0, 3] ) => 0
largestProduct( [4, 7, 2, 3, 6, 4] ) => 168

You may assume that nums.length >= 3


Ask Question