title: Find Pair With Greatest Product In Array
signature: def find_pair_with_greatest_product_in_array(arr, n):
source_py: def find_pair_with_greatest_product_in_array(arr, n):
      result = (- 1)
      for i in range(n):
          for j in range((n - 1)):
              for k in range((j + 1), n):
                  if ((arr[j] * arr[k]) == arr[i]):
                      result = max(result, arr[i])
      return result
source_cpp: int find_pair_with_greatest_product_in_array(vector<int> arr, int n) {
    int result = - 1;
    for ( int i = 0;
    i < n;
    i ++ ) for ( int j = 0;
    j < n - 1;
    j ++ ) for ( int k = j + 1;
    k < n;
    k ++ ) if ( arr [ j ] * arr [ k ] == arr [ i ] ) result = max ( result, arr [ i ] );
    return result;
  }
question_info.test_code: import array
  import bisect
  import collections
  import datetime
  import functools
  import heapq
  import itertools
  import math
  import queue
  import re
  import string
  import sys
  from typing import Any, Dict, List, Optional, Set
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  def validate_solution(actual, expected):
      return actual == expected
  
  def driver(arr, n, expected):
      try:
          if validate_solution(PLACEHOLDER_FN_NAME(
              arr, n),
              expected
          ):
              return "PASSED"
          return "FAILED"
      except Exception as exception_obj:
          return type(exception_obj).__name__
      
  if __name__ == "__main__":
      result = driver([4, 78, 84], 2, -1)
      print(f"TEST-0...{result}")
  
      result = driver([-54, 64, 60, 14, 18, -68, -54, -58, 38, -72, -84, 46, 74, 76, 28, -2, 54, 24, 18, -74, -78, 14, -38, -70, 26, -54, -36, -96, -12, 8, 62, -42, -84, 10, -6, 36, -72, 10, 10, -20, 16, 92, -64, -34, 74, -98, 18], 26, 76)
      print(f"TEST-1...{result}")
  
      result = driver([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 22, 1)
      print(f"TEST-2...{result}")
  
      result = driver([39, 49, 94, 80, 48, 34, 63, 82, 47, 51, 60, 68, 79, 23, 97, 22, 54, 53, 40, 2, 25], 10, -1)
      print(f"TEST-3...{result}")
  
      result = driver([-90, -52, -10, 12, 72], 3, -1)
      print(f"TEST-4...{result}")
  
      result = driver([1, 0, 0], 2, 0)
      print(f"TEST-5...{result}")
  
      result = driver([2, 9, 11, 14, 16, 17, 17, 18, 19, 21, 24, 25, 28, 29, 30, 33, 33, 39, 41, 41, 43, 46, 50, 51, 60, 62, 67, 80, 84, 86, 91, 92, 97], 27, 60)
      print(f"TEST-6...{result}")
  
      result = driver([4], 0, -1)
      print(f"TEST-7...{result}")
  
      result = driver([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 16, 1)
      print(f"TEST-8...{result}")
  
      result = driver([52, 8, 31, 92, 20, 18, 34, 5, 15, 8, 73, 20, 40, 61, 80, 51, 95, 73, 38, 30, 21, 69, 52, 38, 68, 77], 22, 40)
      print(f"TEST-9...{result}")
  
      sys.exit(0)
question_info.test_case_ids: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
question_info.entry_fn_name: find_pair_with_greatest_product_in_array
question_info.test_list: [{"idx": 0, "outputs": -1, "inputs": {"arr": [4, 78, 84], "n": 2}}, {"idx": 1, "outputs": 76, "inputs": {"arr": [-54, 64, 60, 14, 18, -68, -54, -58, 38, -72, -84, 46, 74, 76, 28, -2, 54, 24, 18, -74, -78, 14, -38, -70, 26, -54, -36, -96, -12, 8, 62, -42, -84, 10, -6, 36, -72, 10, 10, -20, 16, 92, -64, -34, 74, -98, 18], "n": 26}}, {"idx": 2, "outputs": 1, "inputs": {"arr": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "n": 22}}, {"idx": 3, "outputs": -1, "inputs": {"arr": [39, 49, 94, 80, 48, 34, 63, 82, 47, 51, 60, 68, 79, 23, 97, 22, 54, 53, 40, 2, 25], "n": 10}}, {"idx": 4, "outputs": -1, "inputs": {"arr": [-90, -52, -10, 12, 72], "n": 3}}, {"idx": 5, "outputs": 0, "inputs": {"arr": [1, 0, 0], "n": 2}}, {"idx": 6, "outputs": 60, "inputs": {"arr": [2, 9, 11, 14, 16, 17, 17, 18, 19, 21, 24, 25, 28, 29, 30, 33, 33, 39, 41, 41, 43, 46, 50, 51, 60, 62, 67, 80, 84, 86, 91, 92, 97], "n": 27}}, {"idx": 7, "outputs": -1, "inputs": {"arr": [4], "n": 0}}, {"idx": 8, "outputs": 1, "inputs": {"arr": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "n": 16}}, {"idx": 9, "outputs": 40, "inputs": {"arr": [52, 8, 31, 92, 20, 18, 34, 5, 15, 8, 73, 20, 40, 61, 80, 51, 95, 73, 38, 30, 21, 69, 52, 38, 68, 77], "n": 22}}]
question_info.entry_cls_name: Solution