Your question is Max Product of Two Integers. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
A Tech Mahindra delivery analytics component receives an array of integer measurements and must identify the pair that produces the greatest product. Given an integer array nums, return the maximum product obtainable by multiplying two distinct elements.
The pair may contain negative values. Therefore, two very small negative numbers can produce the maximum result, so checking only the two largest values is insufficient.
Implement max_product_pair(nums).
nums, a list of at least two integers.def max_product_pair(nums):