Bridge Car Weight
Reported by candidates from GitHub's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
GitHub's Bridge Car Weight problem hit the December 2024 OA with no problem statement provided by candidates. This is a structural puzzle that requires you to figure out the actual constraints from context clues. You're solving for weight distribution across a bridge, likely with capacity limits and multiple cars. The pattern isn't immediately obvious without the full text, but it often hinges on greedy selection or dynamic programming to find an optimal load arrangement. StealthCoder becomes your safety net if you freeze on the live OA and can't recall the exact approach.
Pattern and pitfall
Without the verbatim problem text, the trick likely involves recognizing whether you're maximizing total weight (greedy, always take the heaviest cars that fit) or finding a specific valid arrangement (constraint satisfaction, possibly DP). Bridge problems typically hinge on a weight capacity and the need to either fit the most cars, achieve target weight, or distribute load evenly. The common pitfall is overthinking redistribution when a simple greedy pass works, or conversely, missing that you need DP to track feasibility across subsets. During your live OA, if the problem text is clear and you recognize the greedy pattern immediately, run with it. If it's ambiguous, StealthCoder reading the full prompt alongside you ensures you don't waste 15 minutes on the wrong approach.
If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.
You can drill Bridge Car Weight cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it.
Get StealthCoderYou've seen the question.
Make sure you actually pass GitHub's OA.
GitHub reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Bridge Car Weight FAQ
Is this a greedy problem or DP?+
Greedy works if you're picking cars to maximize count or weight under a single capacity limit. DP is required if you need to find whether a specific total is reachable, or if there are multiple constraints or stages. Read the problem closely. GitHub OAs reward clarity on problem type.
What's the trick if the problem is vague?+
Assume you have a bridge with one weight limit and a list of car weights. Sort by weight and either take greedily (largest first or smallest first depending on goal) or use a subset sum DP. The trick is recognizing which one the examples demonstrate.
How do I prepare in 48 hours without the full problem?+
Practice greedy selection problems (activity selection, fractional knapsack) and 0-1 knapsack DP. Both are common bridge/weight distribution patterns. Run through sorting edge cases and capacity boundary checks in your head.
Should I assume multiple bridges or one?+
Unless the problem says otherwise, assume one bridge with one weight capacity. If candidates reported multiple bridges, the pattern shifts to bin packing or load balancing, which is more complex. Check problem details carefully.
Is this still being asked at GitHub?+
Yes. GitHub OAs include structural and weight-distribution problems regularly. The specific variant changes, but the underlying logic (capacity + selection) is stable. It's a solid signal of systems thinking.