Skip to content

chrisjacksonn/interview-sim / skills/sim

Run 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.

FileKindSize
SKILL.mdskill md21.7 KB
questions/gca/batch-split/meta.jsonconfig265 B
questions/gca/batch-split/mutants/average_target.pyscript131 B
questions/gca/batch-split/mutants/even_chunks.pyscript194 B
questions/gca/batch-split/mutants/exhaustive.pyscript546 B
questions/gca/batch-split/mutants/low_starts_at_zero.pyscript359 B
questions/gca/batch-split/mutants/requires_exact_group_count.pyscript388 B
questions/gca/batch-split/mutants/sorts_first.pyscript388 B
questions/gca/batch-split/mutants/strict_greedy_off_by_one.pyscript389 B
questions/gca/batch-split/problem.mdmarkdown991 B
questions/gca/batch-split/reference.pyscript1.1 KB
questions/gca/batch-split/starter.pyscript473 B
questions/gca/batch-split/tests_hidden.pyscript4.2 KB
questions/gca/batch-split/tests_public.pyscript544 B
questions/gca/bracket-check/meta.jsonconfig249 B
questions/gca/bracket-check/mutants/angle_brackets_count.pyscript283 B
questions/gca/bracket-check/mutants/counts_only.pyscript143 B
questions/gca/bracket-check/mutants/empty_stack_pop.pyscript270 B
questions/gca/bracket-check/mutants/forgets_leftovers.pyscript268 B
questions/gca/bracket-check/mutants/ignores_kind.pyscript241 B
questions/gca/bracket-check/mutants/leftover_openers_pass_patch.pyscript190 B
questions/gca/bracket-check/mutants/recursive.pyscript446 B
questions/gca/bracket-check/mutants/returns_truthy_not_bool.pyscript286 B
questions/gca/bracket-check/problem.mdmarkdown700 B
questions/gca/bracket-check/reference.pyscript410 B
questions/gca/bracket-check/starter.pyscript344 B
questions/gca/bracket-check/tests_hidden.pyscript3.0 KB
questions/gca/bracket-check/tests_public.pyscript620 B
questions/gca/build-order/meta.jsonconfig273 B
questions/gca/build-order/mutants/duplicate_blocks_forever.pyscript814 B
questions/gca/build-order/mutants/no_tiebreak.pyscript589 B
questions/gca/build-order/mutants/partial_on_cycle.pyscript606 B
questions/gca/build-order/mutants/pre_sorted_not_dynamic.pyscript612 B
questions/gca/build-order/mutants/recursive_dfs.pyscript672 B
questions/gca/build-order/mutants/unknown_tasks_counted.pyscript662 B
questions/gca/build-order/problem.mdmarkdown1.4 KB
questions/gca/build-order/reference.pyscript1.1 KB
questions/gca/build-order/starter.pyscript605 B
questions/gca/build-order/tests_hidden.pyscript5.1 KB
questions/gca/build-order/tests_public.pyscript817 B
questions/gca/checkout-rules/meta.jsonconfig504 B
questions/gca/checkout-rules/mutants/accepts_a_free_deal.pyscript1.5 KB
questions/gca/checkout-rules/mutants/accepts_deal_quantity_one.pyscript1.5 KB
questions/gca/checkout-rules/mutants/bad_price_still_stored.pyscript1.5 KB
questions/gca/checkout-rules/mutants/clear_wipes_everything.pyscript1.6 KB
questions/gca/checkout-rules/mutants/deal_applies_once.pyscript1.6 KB
questions/gca/checkout-rules/mutants/leftover_at_deal_price.pyscript1.5 KB
questions/gca/checkout-rules/mutants/leftover_dropped.pyscript1.5 KB
questions/gca/checkout-rules/mutants/price_snapshot_at_scan.pyscript1.6 KB
questions/gca/checkout-rules/problem.mdmarkdown2.6 KB
questions/gca/checkout-rules/reference.pyscript1.6 KB
questions/gca/checkout-rules/starter.pyscript826 B
questions/gca/checkout-rules/tests_hidden.pyscript8.3 KB
questions/gca/checkout-rules/tests_public.pyscript879 B
questions/gca/dup-window/meta.jsonconfig290 B
questions/gca/dup-window/mutants/abs_window.pyscript692 B
questions/gca/dup-window/mutants/case_insensitive.pyscript672 B
questions/gca/dup-window/mutants/dedupes_stamps.pyscript716 B
questions/gca/dup-window/mutants/exclusive_window.pyscript669 B
questions/gca/dup-window/mutants/mutates_input.pyscript703 B
questions/gca/dup-window/mutants/spread_not_gap.pyscript630 B
questions/gca/dup-window/mutants/unsorted_output.pyscript655 B
questions/gca/dup-window/mutants/unsorted_stamps.pyscript674 B
questions/gca/dup-window/problem.mdmarkdown1.0 KB
questions/gca/dup-window/reference.pyscript538 B
questions/gca/dup-window/starter.pyscript430 B
questions/gca/dup-window/tests_hidden.pyscript3.2 KB
questions/gca/dup-window/tests_public.pyscript666 B
questions/gca/floor-robot/meta.jsonconfig523 B
questions/gca/floor-robot/mutants/back_goes_forward.pyscript2.1 KB
questions/gca/floor-robot/mutants/east_wall_off_by_one.pyscript2.2 KB
questions/gca/floor-robot/mutants/floor_wraps.pyscript2.1 KB
questions/gca/floor-robot/mutants/place_ignores_racking.pyscript2.1 KB
questions/gca/floor-robot/mutants/racking_ignored_when_moving.pyscript2.1 KB
questions/gca/floor-robot/mutants/refusal_stops_the_run.pyscript2.2 KB
questions/gca/floor-robot/mutants/turns_are_swapped.pyscript2.1 KB
questions/gca/floor-robot/mutants/unknown_commands_ignored.pyscript2.1 KB
questions/gca/floor-robot/problem.mdmarkdown2.3 KB
questions/gca/floor-robot/reference.pyscript2.2 KB
questions/gca/floor-robot/starter.pyscript693 B
questions/gca/floor-robot/tests_hidden.pyscript7.4 KB
questions/gca/floor-robot/tests_public.pyscript717 B
questions/gca/log-window/meta.jsonconfig255 B
questions/gca/log-window/mutants/forgets_first_window.pyscript246 B
questions/gca/log-window/mutants/no_width_guard.pyscript225 B
questions/gca/log-window/mutants/off_by_one_range.pyscript250 B
questions/gca/log-window/mutants/quadratic.pyscript152 B
questions/gca/log-window/mutants/returns_average.pyscript257 B
questions/gca/log-window/mutants/wrong_subtract_index.pyscript250 B
questions/gca/log-window/problem.mdmarkdown735 B
questions/gca/log-window/reference.pyscript491 B
questions/gca/log-window/starter.pyscript418 B
questions/gca/log-window/tests_hidden.pyscript2.6 KB
questions/gca/log-window/tests_public.pyscript560 B
questions/gca/merge-feeds/meta.jsonconfig255 B
questions/gca/merge-feeds/mutants/advances_wrong_feed.pyscript437 B
questions/gca/merge-feeds/mutants/dedupes.pyscript127 B
questions/gca/merge-feeds/mutants/forgets_empty_feeds.pyscript336 B
questions/gca/merge-feeds/mutants/mutates_input.pyscript324 B
questions/gca/merge-feeds/mutants/negative_limit_slice.pyscript398 B
questions/gca/merge-feeds/mutants/never_advances.pyscript379 B
questions/gca/merge-feeds/mutants/only_first_feed.pyscript101 B
questions/gca/merge-feeds/mutants/sorts_the_input.pyscript989 B
questions/gca/merge-feeds/mutants/unsorted_output.pyscript168 B
questions/gca/merge-feeds/problem.mdmarkdown1011 B
questions/gca/merge-feeds/reference.pyscript971 B
questions/gca/merge-feeds/starter.pyscript439 B
questions/gca/merge-feeds/tests_hidden.pyscript4.3 KB
questions/gca/merge-feeds/tests_public.pyscript683 B
questions/gca/pack-combinations/meta.jsonconfig286 B
questions/gca/pack-combinations/mutants/assigns_instead_of_adds.pyscript341 B
questions/gca/pack-combinations/mutants/counts_permutations.pyscript344 B
questions/gca/pack-combinations/mutants/descending_inner_loop.pyscript337 B
questions/gca/pack-combinations/mutants/duplicates_multiply.pyscript267 B
questions/gca/pack-combinations/mutants/exponential.pyscript400 B
questions/gca/pack-combinations/mutants/modulo.pyscript311 B
questions/gca/pack-combinations/mutants/off_by_one_range.pyscript345 B
questions/gca/pack-combinations/mutants/zero_target_is_zero.pyscript301 B
questions/gca/pack-combinations/problem.mdmarkdown1000 B
questions/gca/pack-combinations/reference.pyscript738 B
questions/gca/pack-combinations/starter.pyscript495 B
questions/gca/pack-combinations/tests_hidden.pyscript3.8 KB
questions/gca/pack-combinations/tests_public.pyscript628 B
questions/gca/request-budget/meta.jsonconfig558 B
questions/gca/request-budget/mutants/closed_boundary.pyscript1.4 KB
questions/gca/request-budget/mutants/count_never_expires.pyscript1.4 KB
questions/gca/request-budget/mutants/counts_refusals.pyscript1.4 KB
questions/gca/request-budget/mutants/empty_key_allowed.pyscript1.3 KB
questions/gca/request-budget/mutants/no_expiry_on_allow.pyscript1.3 KB
questions/gca/request-budget/mutants/no_validation.pyscript1.2 KB
questions/gca/request-budget/mutants/off_by_one_limit.pyscript1.4 KB
questions/gca/request-budget/mutants/shared_budget.pyscript1.4 KB
questions/gca/request-budget/problem.mdmarkdown2.4 KB
questions/gca/request-budget/reference.pyscript1.6 KB
questions/gca/request-budget/starter.pyscript601 B
questions/gca/request-budget/tests_hidden.pyscript8.1 KB
questions/gca/request-budget/tests_public.pyscript1.1 KB
questions/gca/room-schedule/meta.jsonconfig266 B
questions/gca/room-schedule/mutants/assumes_sorted.pyscript207 B
questions/gca/room-schedule/mutants/closed_intervals.pyscript251 B
questions/gca/room-schedule/mutants/counts_total_meetings.pyscript71 B
questions/gca/room-schedule/mutants/final_not_peak.pyscript226 B
questions/gca/room-schedule/mutants/keeps_degenerate.pyscript196 B
questions/gca/room-schedule/mutants/quadratic_pairwise.pyscript205 B
questions/gca/room-schedule/problem.mdmarkdown860 B
questions/gca/room-schedule/reference.pyscript721 B
questions/gca/room-schedule/starter.pyscript408 B
questions/gca/room-schedule/tests_hidden.pyscript3.5 KB
questions/gca/room-schedule/tests_public.pyscript585 B
questions/gca/route-fuel/meta.jsonconfig294 B
questions/gca/route-fuel/mutants/bool_when_no_stops.pyscript739 B
questions/gca/route-fuel/mutants/first_not_largest.pyscript526 B
questions/gca/route-fuel/mutants/no_sort.pyscript637 B
questions/gca/route-fuel/mutants/off_by_one_stops.pyscript652 B
questions/gca/route-fuel/mutants/returns_stops_when_stuck.pyscript652 B
questions/gca/route-fuel/mutants/smallest_depot.pyscript670 B
questions/gca/route-fuel/mutants/sorts_in_place.pyscript590 B
questions/gca/route-fuel/mutants/strictly_less_reachable.pyscript644 B
questions/gca/route-fuel/problem.mdmarkdown1.1 KB
questions/gca/route-fuel/reference.pyscript850 B
questions/gca/route-fuel/starter.pyscript480 B
questions/gca/route-fuel/tests_hidden.pyscript3.2 KB
questions/gca/route-fuel/tests_public.pyscript600 B
questions/gca/run-compression/meta.jsonconfig252 B
questions/gca/run-compression/mutants/always_compresses.pyscript292 B
questions/gca/run-compression/mutants/case_insensitive.pyscript329 B
questions/gca/run-compression/mutants/compresses_twos.pyscript313 B
questions/gca/run-compression/mutants/counts_total_not_run.pyscript334 B
questions/gca/run-compression/mutants/drops_final_run.pyscript267 B
questions/gca/run-compression/mutants/threshold_four.pyscript313 B
questions/gca/run-compression/problem.mdmarkdown901 B
questions/gca/run-compression/reference.pyscript632 B
questions/gca/run-compression/starter.pyscript343 B
questions/gca/run-compression/tests_hidden.pyscript3.0 KB
questions/gca/run-compression/tests_public.pyscript648 B
questions/gca/sensor-gaps/meta.jsonconfig263 B
questions/gca/sensor-gaps/mutants/dedupes.pyscript289 B
questions/gca/sensor-gaps/mutants/first_gap.pyscript249 B
questions/gca/sensor-gaps/mutants/includes_singletons.pyscript282 B
questions/gca/sensor-gaps/mutants/no_grouping.pyscript207 B
questions/gca/sensor-gaps/mutants/span_not_gap.pyscript235 B
questions/gca/sensor-gaps/mutants/takes_min.pyscript283 B
questions/gca/sensor-gaps/mutants/unsorted.pyscript265 B
questions/gca/sensor-gaps/problem.mdmarkdown1.2 KB
questions/gca/sensor-gaps/reference.pyscript582 B
questions/gca/sensor-gaps/starter.pyscript418 B
questions/gca/sensor-gaps/tests_hidden.pyscript3.5 KB
questions/gca/sensor-gaps/tests_public.pyscript748 B
questions/gca/sensor-median/meta.jsonconfig306 B
questions/gca/sensor-median/mutants/int_division_even.pyscript774 B
questions/gca/sensor-median/mutants/lower_of_the_two.pyscript746 B
questions/gca/sensor-median/mutants/middle_off_by_one.pyscript751 B
questions/gca/sensor-median/mutants/mutates_input.pyscript625 B
questions/gca/sensor-median/mutants/no_width_guard.pyscript817 B
questions/gca/sensor-median/mutants/odd_returns_int.pyscript766 B
questions/gca/sensor-median/mutants/pops_front_not_leaving.pyscript703 B
questions/gca/sensor-median/mutants/unsorted_window.pyscript607 B
questions/gca/sensor-median/problem.mdmarkdown851 B
questions/gca/sensor-median/reference.pyscript770 B
questions/gca/sensor-median/starter.pyscript391 B

questions/gca/request-budget/problem.md

View on GitHub
# Request Budget

An API gateway has to stop any one client from flooding it. You are writing the
part that decides, for each incoming request, whether it is inside that client's
budget.

Build a class `RateLimiter`.

## The API

```python
RateLimiter(limit, window)
```

At most `limit` requests are allowed for any one client in any `window` seconds.
`limit` is an integer of at least 1. `window` is a positive number of seconds.

```python
allow(key, at) -> bool
```

A request from client `key` arrives at time `at`, in seconds. Return `True` if it
is inside the budget, and `False` if it is not.

An allowed request counts against the budget for `window` seconds. A refused
request does not count against anything: being turned away must not make the
next request more likely to be turned away too.

```python
count(key, at) -> int
```

How many allowed requests for `key` are still inside the budget at time `at`.
Zero for a client that has never been seen.

## The window

The window is the half-open interval `(at - window, at]`.

A request recorded at exactly `at - window` has expired and no longer counts. One
recorded a moment after it still does.

So with `limit=2, window=10`, requests at times 0 and 5 fill the budget. A
request at 9 is refused, because 0 and 5 are both still inside `(-1, 9]`. A
request at 10 is allowed, because the one at 0 has expired: only 5 remains inside
`(0, 10]`.

## Examples

```python
limiter = RateLimiter(2, 10)
limiter.allow("a", 0)      # True
limiter.allow("a", 5)      # True
limiter.allow("a", 9)      # False, budget is full
limiter.count("a", 9)      # 2
limiter.allow("a", 10)     # True, the request at 0 has expired
limiter.count("a", 10)     # 2, the ones at 5 and 10
```

```python
limiter = RateLimiter(1, 60)
limiter.allow("alice", 0)      # True
limiter.allow("bob", 0)        # True, clients are independent
limiter.allow("alice", 30)     # False
limiter.allow("alice", 60)     # True
```

## Constraints

- `at` never goes backwards: calls arrive in non-decreasing time order.
- `at` may repeat. Several requests can share a timestamp.
- Times may be negative, and may be floats.
- `key` is a non-empty string. An empty key is not a client: refuse it, count it
  as nothing, and do not raise.
- Up to 200,000 calls, across up to 10,000 clients. A solution that rescans a
  client's whole history on every call will be too slow.
- `RateLimiter(0, 10)` and `RateLimiter(2, 0)` are not valid. Raise `ValueError`.
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: 198kUpdated Claude CodeCodexVerifiedInstall
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: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
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: 194kUpdated Claude CodeCodexVerifiedInstall