File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ """
2
+ Question: Minimum Pairwise Product
3
+
4
+ You are given an array of N size, and another array of M size.
5
+
6
+ `Compatibility` of two arrays A and B is measured as:
7
+
8
+ 1. Two arrays are compatible if and only if they have an equal number of elements.
9
+ 2. `Compatibility` value of arrays A and B each having length L = A1*B1 + A2*B2 + … + AL*BL.
10
+
11
+ You can remove any number of element from both of these arrays to get an `compatibility`.
12
+
13
+ Print the maximum possible `compatibility`.
14
+
15
+ Input Format
16
+ First line contains two space separated integers denoting N and M.
17
+ Next line contains N space separated integers denoting the elements of array A.
18
+ Next line contains M space separated integers denoting the elements of array B.
19
+
20
+ Output Format
21
+ Print the maximum compatibility value it's possible to achieve by removing some elements from both the arrays
22
+
23
+ Constraints
24
+ 1<=N,M<=1000
25
+ -105<=Ai, Bi<=105
26
+
27
+ Sample Input 1
28
+ 3 4
29
+ -1 2 1
30
+ -100 3 10 -9
31
+
32
+ Sample Output 1
33
+ 120
34
+
35
+ Explanation of Sample 1
36
+ Erase the 3rd element of array A. Array A becomes = [-1, 2]
37
+ Erase the 2nd and 4th element of array A. Array A becomes = [-100, 10]
38
+ Compatibility values of these arrays = [(-1)*(-100) + 2*10] = 120
39
+ """
You can’t perform that action at this time.
0 commit comments