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/reference.py

View on GitHub
"""Request Budget: reference solution.

A deque per client, holding the timestamps of allowed requests only. Every call
first drops the front while it has expired, which is O(1) amortised because each
timestamp is appended once and popped once.

Keeping refused requests out of the deque is the whole of the "a refusal must not
make the next refusal more likely" rule, and it falls out of only appending on
the allowed path.
"""

from collections import deque


class RateLimiter:
    def __init__(self, limit, window):
        if not isinstance(limit, int) or isinstance(limit, bool) or limit < 1:
            raise ValueError("limit must be an integer of at least 1")
        if window <= 0:
            raise ValueError("window must be positive")
        self.limit = limit
        self.window = window
        self._seen = {}

    def _live(self, key, at):
        """The client's still-counting timestamps, expired ones dropped."""
        events = self._seen.get(key)
        if events is None:
            return None
        cutoff = at - self.window
        while events and events[0] <= cutoff:
            events.popleft()
        return events

    def allow(self, key, at):
        if not isinstance(key, str) or not key:
            return False
        events = self._live(key, at)
        if events is None:
            events = deque()
            self._seen[key] = events
        if len(events) >= self.limit:
            return False
        events.append(at)
        return True

    def count(self, key, at):
        if not isinstance(key, str) or not key:
            return 0
        events = self._live(key, at)
        return len(events) if events else 0
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