Maximum Product Of Two Numbers
Basic Acceptance 81.34% Points 10.00
You are given an array arr[] of non-negative integers, return the maximum product of two numbers possible.
Examples
Example 1
Example 1
Input: arr[] = [1, 4, 3, 6, 7, 0]
Output: 42
Explanation: 6 and 7 have the maximum product.
Example 2
Example 2
Input: arr[] = [1, 100, 42, 4, 23]
Output: 4200
Explanation: 42 and 100 have the maximum product.
Hints
Hint 1
Expected Time Complexity: O(n)
Hint 2
Expected Auxiliary Space: O(1)
Constraints
- 2 <= arr.size <= 10^7
- 0 <= arr[i] <= 10^9
Topics
Array Sorting Algorithms
Track your submissions
Please log in to review your progress and explore code submissions from other participants.
Unlock the full solution
Please log in to access detailed answers and explanations.
Join the discussion
Please log in to join conversations with other participants.