Two arrays, A , B, of equal size. Find minimum value of A[0] * B[0] + A[1] * B[1] +…+ A[N-1] * B[N-1], where shuffling of eleme | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Two arrays, A , B, of equal size. Find minimum value of A[0] * B[0] + A[1] * B[1] +…+ A[N-1] * B[N-1], where shuffling of eleme

I used permutations nd product libraries but exec timed out, also that was obv a direct unnecessarily memory nd time consuming code https://code.sololearn.com/cSCcpV70akiE/?ref=app

22nd May 2020, 8:30 AM
Niranjan
Niranjan - avatar
3 Answers
+ 1
so please describe the problem in future more detailed.)) you need rhe minimal sum of 2 arrays elements multiplication. vheck my code https://code.sololearn.com/cpU4sf3Tq08O/?ref=app the algorithm is very easy. the min value of sum(ai*bj) all variants is following 1 array sprt ascending, second descending multiply elements and sum)
22nd May 2020, 6:15 PM
george
george - avatar
+ 1
First of all you need write the wiki, read some other sources. Also you need read book and internet sources about algorithms and practice practice practice. So in future you will begin to think more widely
23rd May 2020, 5:12 AM
george
george - avatar
0
Ok.. Sorry for lack of info, nd thanks for the soln. Cud pls tell me how to reach in such conclusions or algorithm when given a problem like this
23rd May 2020, 12:46 AM
Niranjan
Niranjan - avatar