Optimize Memory Usage Problem Statement

Alex wants to maximize the use of 'K' memory spaces on his computer. He has 'N' different document downloads, each with unique memory usage, and 'M' computer games, each with unique memory usage. The computer can execute at most one download and one game at the same time, without exceeding the memory limit 'K'. Determine the pairs of downloads and games to maximize the memory usage.

Example:

Input:
T = 1
N = 3, M = 3, K = 10
download = [4, 8, 5]
game = [2, 1, 6]
Output:
[[1, 0], [2, -1]]

Constraints:

  • 1 <= T <= 10
  • 1 <= N, M <= 10^5
  • 1 <= K <= 10^9
  • 1 <= game[i], download[i] <= 10^6
  • Time Limit: 1 sec
Note:
You only need to implement the function and return the result; printing is handled elsewhere.
Be the first one to answer
Add answer anonymously...
Arcesium Software Developer Intern Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter