Code RoomTwo-item calorie pair
EasyPrep Room Coding #598

Two-item calorie pair

CodingAlgorithms & data structuresEntry–Mid~11 min

A meal-planning app lists menu items by calories in ascending order. Given the sorted list calories and a daily budget, find two different items whose calories add up exactly to the budget. Return their 0-based indices as [i, j] with i < j, or an empty list if no such pair exists. Aim for a single pass with two pointers rather than checking every pair. Example: calories = [150, 250, 300, 450, 600], budget = 550 gives [1, 2].

Implement
find_calorie_pair(calories: list[int], budget: int) → list[int]
Examples
in[[150,250,300,450,600],550]out[1,2]
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 11 min
InputExpectedGot
[[150,250,300,450,600],550][1,2]not run yetsample