Leetcode 1464: Maximum product of two elements in an array

In this Leetcode problem, we are asked to compute the maximum product of 2 elements in the array, knowing that the elements are positive.

Problem statement

Solution

  1. According to the constraints, all numbers are positive ( >0 )
  2. Therefore the problem is equivalent to finding the 2 highest numbers in the array (a, b), and return…

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store