DSAMaster Logo
DSAMaster
BackmediumIntroduction to Arrays

Pairs With Total High Calorie

Problem Description

You are given two arrays of integers representing the number of high-calorie bars in each ration pack. Find all pairs of ration packs that have a total number of high-calorie bars equal to a given target.

Example 1
Input
[4, 2, 3, 1, 5] 27
Output
[[3, 4], [2, 5]]

Explanation: The pairs of ration packs are [3, 4] and [2, 5]. However, their totals are 7 and 10 respectively, not 27.

Constraints

  • The two input arrays can have different lengths.
  • The input arrays can have negative numbers.
  • The input arrays can have zeros.
  • The target number can be negative.
00:00
Loading...

Sign in to Solve

Access the full code editor, ThinkBuddy AI hints, and track your progress.

Sign in Free
Test Cases & Output
Enter test input here...
Click "Run Code" to execute