Get a free weekly practice problem!

Keep that axe sharp.

× No thanks

You only have free questions left (including this one).

But it doesn't have to end here! Sign up for the 7-day coding interview crash course and you'll get a free Interview Cake problem every week.

Given an array of integers, find the highest product you can get from three of the integers.

The input arrayOfInts will always have at least three integers.

Does your method work with negative numbers? If arrayOfInts is [-10, -10, 1, 3, 2] we should return 300 (which we get by taking -10 * -10 * 3).

We can do this in time and space.

Start your free trial!

Log in or sign up with one click to get immediate access to free mock interview questions

Start your free trial!

Log in or sign up with one click to get immediate access to free mock interview questions

time and additional space.

  1. What if we wanted the highest product of 4 items?
  2. What if we wanted the highest product of k items?
  3. If our highest product is really big, it could overflow. How should we protect against this?

Start your free trial!

Log in or sign up with one click to get immediate access to free mock interview questions

What's next?

Reset editor

Powered by qualified.io

. . .