{"id":12872,"date":"2021-09-30T16:30:26","date_gmt":"2021-09-30T11:00:26","guid":{"rendered":"https:\/\/python-programs.com\/?p=12872"},"modified":"2021-11-22T18:33:35","modified_gmt":"2021-11-22T13:03:35","slug":"python-program-to-find-pair-with-the-greatest-product-in-an-array-or-list","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-find-pair-with-the-greatest-product-in-an-array-or-list\/","title":{"rendered":"Python Program to find Pair with the Greatest Product in an Array or List"},"content":{"rendered":"

Assume we are given an array with a number of elements our objective is to determine the highest value that is the product of two elements from the given array. If there is no such element, the output should be -1.<\/p>\n

Given a list, the task is to find a pair with the greatest Product in the given array or list if the pair is not found then print -1.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given list = [11, 2, 6, 12, 9, 99]<\/pre>\n

Output:<\/strong><\/p>\n

The Maximum product of pairs in the given list [11, 2, 6, 12, 9, 99] is [ 99 ]<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given list = [11, 19, 24, 2, 48, 96]<\/pre>\n

Output:<\/strong><\/p>\n

Enter some random List Elements separated by spaces = 11 19 24 2 48 96\r\nThe Maximum product of pairs in the given list [11, 19, 24, 2, 48, 96] is [ 96 ]<\/pre>\n

Program to find Pair with the Greatest Product in an Array or List in Python<\/h2>\n

Below are the ways to find a pair with the greatest Product in the given array or list if the pair is not found then print -1.<\/p>\n