• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
May 07, 2024 |1.1K Views
SDE Sheet - Minimize the sum of product
  Share  2 Likes
Description
Discussion

This video is part of the Greedy section under GFG SDE Sheet.

In this problem, we are given two arrays, A and B, of equal size N. The task is to find the minimum value of A[0] * B[0] + A[1] * B[1] + .... + A[N-1] * B[N-1], where shuffling of elements of arrays A and B is allowed.

Example :

Input:
N = 3 
A[] = {3, 1, 1}
B[] = {6, 5, 4}
Output:
23 
Explanation:
1*6+1*5+3*4 = 6+5+12= 23 is the minimum sum

Try it out before watching the implementation of the problem in the video. We recommend watching the video, even if you can solve the problem. You may discover something new. All the best!!!

Do check out:-
Article: https://www.geeksforgeeks.org/minimize-sum-product-two-arrays-permutations-allowed/
Problem: https://www.geeksforgeeks.org/problems/minimize-the-sum-of-product1525/1
SDE Sheet Link: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/