Code Room
CodingEasycod-g1189
Subject ArraysLevel Entry–Mid~11 minCommon in Distributed systems · Algorithms & data structures interviewsIndustries Software development

Question

A storefront wants bargain items shown before everything else. Given a list of item prices and a bargain limit, return the list rearranged so all prices strictly below the limit come first, followed by the rest — and within each of the two groups, the original relative order is preserved. Example: [8, 3, 10, 1, 5] with limit 6 becomes [3, 1, 5, 8, 10].

Implement
bargains_first(prices: list[int], limit: int) → list[int]
Examples
in[[8,3,10,1,5],6]out[3,1,5,8,10]
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.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.