Given two arrays of A and B respectively of sizes N_{1} and N_{2}, the task is to calculate the product of the maximum element of the first array and minimum element of the second array.
Example 1:
Input : A[] = {5, 7, 9, 3, 6, 2}, 
        B[] = {1, 2, 6, -1, 0, 9}
Output : -9
Explanation:
The first array is 5 7 9 3 6 2. 
The max element among these elements is 9.
The second array is 1 2 6 -1 0 9.
The min element among these elements is -1.
The product of 9 and -1 is 9*-1=-9.
Example 2:
Input : A[] = {0, 0, 0, 0}, 
           B[] = {1, -1, 2}
Output : 0
Your Task:
This is a function problem. The input is already taken care of by the driver code. You only need to complete the function find_multiplication() that takes an array of integer (A), another array of integer (B), size of array A(n), size of array B(m) and return the product of the max element of the first array and the minimum element of the second array. The driver code takes care of the printing.
Expected Time Complexity: O(N + M).
Expected Auxiliary Space: O(1).
 
Output:
For each test case, output the product of the max element of the first array and the minimum element of the second array.
Constraints:
1 ≤ N, M_{ }≤ 10^{6}
-10^{8} ≤ A_{i, }B_{i} ≤ 10^{8}

Difficulty: EASY
Tags: Data structures
Skill types: Data structures
Expected Time Complexity: O(N + M).
Expected Auxiliary Space: O(1).

Starter code:
#User function Template for python3



class Solution:

    def find_multiplication (self, arr, brr, n, m) : 

        #Complete the function



Solutions:
class Solution:

	def find_multiplication(self, arr, brr, n, m):
		a = max(arr)
		b = min(brr)
		return a * b


class Solution:

	def find_multiplication(self, arr, brr, n, m):
		arr.sort()
		brr.sort()
		a = arr[-1]
		b = brr[0]
		c = a * b
		return c


class Solution:

	def find_multiplication(self, arr, brr, n, m):
		arr.sort()
		brr.sort()
		x = arr.pop(n - 1)
		y = brr.pop(0)
		return x * y


class Solution:

	def find_multiplication(self, arr, brr, n, m):
		arr.sort()
		brr.sort()
		return arr[n - 1] * brr[0]


class Solution:

	def find_multiplication(self, arr, brr, n, m):
		largest = arr[0]
		for i in range(n):
			if largest < arr[i]:
				largest = arr[i]
		smallest = brr[0]
		for j in range(m):
			if smallest > brr[j]:
				smallest = brr[j]
		product = largest * smallest
		return product


class Solution:

	def find_multiplication(self, arr, brr, n, m):
		mi = 100000000000000
		ma = -100000000000000
		for i in arr:
			if ma < i:
				ma = i
		for i in brr:
			if mi > i:
				mi = i
		return mi * ma


class Solution:

	def find_multiplication(self, arr, brr, n, m):
		item1 = max(arr)
		item2 = min(brr)
		return item1 * item2


class Solution:

	def find_multiplication(self, arr, brr, n, m):
		v = max(arr)
		w = min(brr)
		a = v * w
		return a


class Solution:

	def find_multiplication(self, arr, brr, n, m):
		x = max(arr)
		y = min(brr)
		return x * y


class Solution:

	def find_multiplication(self, arr, brr, n, m):
		arr.sort()
		brr.sort()
		for i in range(0, n):
			for j in range(0, m):
				return arr[n - 1] * brr[0]


class Solution:

	def find_multiplication(self, arr, brr, n, m):
		ma = max(arr)
		mi = min(brr)
		return ma * mi


class Solution:

	def find_multiplication(self, A, B, n, m):
		maxx = 0
		minn = 0
		A.sort()
		maxx = A[-1]
		B.sort()
		minn = B[0]
		return maxx * minn


class Solution:

	def find_multiplication(self, arr, brr, n, m):
		arr.sort(reverse=True)
		brr.sort()
		return arr[0] * brr[0]


class Solution:

	def find_multiplication(self, arr, brr, n, m):
		m1 = max(arr)
		m2 = min(brr)
		prod = m1 * m2
		return prod


class Solution:

	def find_multiplication(self, arr, brr, n, m):
		min_val = brr[0]
		max_val = arr[0]
		for i in range(1, n):
			if arr[i] > max_val:
				max_val = arr[i]
		for i in range(1, m):
			if brr[i] < min_val:
				min_val = brr[i]
		return max_val * min_val


class Solution:

	def find_multiplication(self, arr, brr, n, m):
		first_arr = max(arr)
		second_arr = min(brr)
		return first_arr * second_arr


class Solution:

	def find_multiplication(self, arr, brr, n, m):
		M = max(arr)
		N = min(brr)
		return M * N


class Solution:

	def find_multiplication(self, arr, brr, n, m):
		maxi = max(arr)
		mini = min(brr)
		return maxi * mini


class Solution:

	def find_multiplication(self, arr, brr, n, m):
		max = arr[0]
		for i in arr:
			if max < i:
				max = i
		min = brr[0]
		for i in brr:
			if i <= min:
				min = i
		return max * min


class Solution:

	def find_multiplication(self, arr, brr, n, m):
		max = -999999
		min = 999999
		for i in arr:
			if i > max:
				max = i
		for j in brr:
			if j < min:
				min = j
		return min * max


class Solution:

	def find_multiplication(self, a, b, n, m):
		maxi = max(a)
		mini = min(b)
		return maxi * mini


class Solution:

	def find_multiplication(self, arr, brr, n, m):
		a = arr[0]
		b = brr[0]
		for i in arr:
			if i > a:
				a = i
		for i in brr:
			if i < b:
				b = i
		return a * b


class Solution:

	def find_multiplication(self, arr, brr, n, m):
		min1 = brr[0]
		max1 = arr[0]
		for i in brr:
			if i < min1:
				min1 = i
		for j in arr:
			if j > max1:
				max1 = j
		return min1 * max1


class Solution:

	def find_multiplication(self, arr, brr, n, m):
		arr.sort()
		brr.sort()
		return max(arr) * min(brr)


class Solution:

	def find_multiplication(self, arr, brr, n, m):
		list1 = list(arr)
		list2 = list(brr)
		list1.sort()
		list2.sort()
		return list1[-1] * list2[0]


class Solution:

	def find_multiplication(self, arr, brr, n, m):
		m = arr[0]
		for i in range(len(arr)):
			if arr[i] > m:
				m = arr[i]
		n = brr[0]
		for j in range(len(brr)):
			if brr[j] < n:
				n = brr[j]
		return n * m


class Solution:

	def find_multiplication(self, arr, brr, n, m):
		fa = max(arr)
		la = min(brr)
		return fa * la


class Solution:

	def find_multiplication(self, arr, brr, n, m):
		a1 = max(arr)
		a2 = min(brr)
		return a1 * a2


class Solution:

	def find_multiplication(self, arr, brr, n, m):
		mx = max(arr)
		mn = min(brr)
		return mx * mn


class Solution:

	def find_multiplication(self, arr, brr, n, m):
		maxx = max(arr)
		minn = min(brr)
		return maxx * minn


class Solution:

	def find_multiplication(self, arr, brr, n, m):
		p = max(arr)
		k = min(brr)
		return p * k


class Solution:

	def find_multiplication(self, arr, brr, n, m):
		num1 = max(arr)
		num2 = min(brr)
		return num1 * num2


class Solution:

	def find_multiplication(self, arr, brr, n, m):
		x = arr.sort()
		y = brr.sort()
		x1 = arr[-1]
		y1 = brr[0]
		return x1 * y1


class Solution:

	def find_multiplication(self, arr, brr, n, m):
		s = max(arr)
		s1 = min(brr)
		return s * s1