chrisjacksonn/interview-sim / skills/sim
sim
VerifiedRun a timed coding assessment simulation in the terminal. Use for OA practice, GCA or ICA mocks, mock interviews, pairing rounds, take-homes, and pasted job postings.
questions/gca/route-fuel/problem.md
View on GitHub# Route Fuel
A van drives a straight route of `distance` kilometres. It burns one litre per
kilometre and starts with `start_fuel` litres.
Along the way are depots, each `(position, litres)`, where `position` is the
distance from the start. The van may stop at any depot it can reach and take all
of its fuel. The tank has no limit.
Write `solve(distance, start_fuel, depots)` returning the smallest number of
stops needed to reach the end, or `-1` if it cannot be done.
## Examples
```python
solve(100, 10, [(10, 60), (20, 30), (30, 30), (60, 40)])
# 2
# Stop at 10 for 60, then at 60 for 40.
solve(100, 100, [])
# 0
solve(100, 1, [(10, 100)])
# -1
# It runs dry before the first depot.
solve(100, 50, [(25, 25), (50, 25)])
# 2
```
## Constraints
- `1 <= distance <= 1_000_000_000`
- `0 <= start_fuel <= 1_000_000_000`
- `0 <= len(depots) <= 100_000`
- Depots arrive in no particular order and may share a position.
- A depot exactly at `distance` is useless: arriving there is finishing.
- The input you are given must be left as it was. Do not modify or consume it.
Trying every combination of stops will not finish in time.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |