VOOZH about

URL: https://www.geeksforgeeks.org/dsa/minimum-product-pair-an-array-of-positive-integers/

⇱ Minimum Product Pair in an Array of Positive Integers - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Minimum Product Pair in an Array of Positive Integers

Last Updated : 13 Jun, 2026

Given an array arr[] of positive integers. The task is to print the minimum product of any two numbers of the given array.

Examples: 

Input: arr[] = [2, 7, 3, 4]
Output: 6
Explanation: The minimum product of any two numbers will be 2 * 3 = 6.

Input: arr[] = [198, 76, 544, 123, 154, 675]
Output:  9348
Explanation: The minimum product of any two numbers will be 76 * 123 = 9348.

[Naive Approach] Check All Pairs – O(n ^ 2) Time O(1) Space

The idea is to generate all possible pairs of elements in the array and compute their product. Keep track of the minimum product encountered during the traversal.


Output
9348

Time Complexity: O(n ^ 2)
Auxiliary Space: O(1)

[Expected Approach] Find Two Smallest Elements – O(n) Time O(1) Space

The idea is to find the smallest and second smallest elements in a single traversal of the array. Since all elements are positive, the minimum product will always be formed by the two smallest numbers.


Output
9348

Time Complexity: O(n)
Auxiliary Space: O(1)

Comment
Article Tags: