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/checkout-rules/tests_hidden.py

View on GitHub
"""Checkout Rules hidden suite.

Never copied into a session workspace.

Weighted toward the two things a working-looking till gets wrong: the leftover
after a deal, and prices that change while the basket already holds the item.
"""

import unittest

from solution import Checkout


class TestCheckoutRules(unittest.TestCase):
    def setUp(self):
        self.till = Checkout()

    # --- prices and scanning ---

    def test_empty_basket(self):
        self.assertEqual(self.till.total(), 0)

    def test_one_item(self):
        self.till.set_price("apple", 50)
        self.assertIs(self.till.scan("apple"), True)
        self.assertEqual(self.till.total(), 50)

    def test_several_of_the_same(self):
        self.till.set_price("apple", 50)
        for _ in range(3):
            self.till.scan("apple")
        self.assertEqual(self.till.total(), 150)

    def test_different_items(self):
        self.till.set_price("apple", 50)
        self.till.set_price("bread", 210)
        self.till.scan("apple")
        self.till.scan("bread")
        self.assertEqual(self.till.total(), 260)

    def test_an_unpriced_sku_is_refused(self):
        self.assertIs(self.till.scan("ghost"), False)
        self.assertEqual(self.till.total(), 0)

    def test_scanning_returns_actual_booleans(self):
        self.till.set_price("apple", 50)
        self.assertIsInstance(self.till.scan("apple"), bool)
        self.assertIsInstance(self.till.scan("ghost"), bool)

    def test_skus_are_case_sensitive(self):
        self.till.set_price("Apple", 50)
        self.assertIs(self.till.scan("apple"), False)
        self.assertIs(self.till.scan("Apple"), True)

    # --- deals ---

    def test_a_deal_at_exactly_its_quantity(self):
        self.till.set_price("apple", 50)
        self.till.set_deal("apple", 3, 130)
        for _ in range(3):
            self.till.scan("apple")
        self.assertEqual(self.till.total(), 130)

    def test_below_the_deal_quantity_is_unit_priced(self):
        self.till.set_price("apple", 50)
        self.till.set_deal("apple", 3, 130)
        for _ in range(2):
            self.till.scan("apple")
        self.assertEqual(self.till.total(), 100)

    def test_the_leftover_after_a_deal(self):
        self.till.set_price("apple", 50)
        self.till.set_deal("apple", 3, 130)
        for _ in range(4):
            self.till.scan("apple")
        self.assertEqual(self.till.total(), 180)

    def test_the_deal_applies_more_than_once(self):
        self.till.set_price("apple", 50)
        self.till.set_deal("apple", 3, 130)
        for _ in range(7):
            self.till.scan("apple")
        self.assertEqual(self.till.total(), 310)

    def test_two_items_with_different_deals(self):
        self.till.set_price("apple", 50)
        self.till.set_deal("apple", 3, 130)
        self.till.set_price("tin", 40)
        self.till.set_deal("tin", 2, 70)
        for _ in range(4):
            self.till.scan("apple")
        for _ in range(5):
            self.till.scan("tin")
        # apples 130 + 50, tins 70 + 70 + 40
        self.assertEqual(self.till.total(), 180 + 180)

    def test_a_deal_on_one_item_leaves_the_other_alone(self):
        self.till.set_price("apple", 50)
        self.till.set_price("tin", 40)
        self.till.set_deal("apple", 2, 90)
        for _ in range(2):
            self.till.scan("apple")
            self.till.scan("tin")
        self.assertEqual(self.till.total(), 90 + 80)

    def test_replacing_a_deal(self):
        self.till.set_price("apple", 50)
        self.till.set_deal("apple", 3, 130)
        self.till.set_deal("apple", 2, 95)
        for _ in range(4):
            self.till.scan("apple")
        self.assertEqual(self.till.total(), 190)

    def test_a_deal_for_an_unpriced_sku_is_refused(self):
        self.assertIs(self.till.set_deal("ghost", 3, 100), False)
        self.till.set_price("ghost", 50)
        for _ in range(3):
            self.till.scan("ghost")
        self.assertEqual(self.till.total(), 150)

    def test_a_deal_quantity_below_two_is_refused(self):
        self.till.set_price("apple", 50)
        self.assertIs(self.till.set_deal("apple", 1, 30), False)
        self.till.scan("apple")
        self.assertEqual(self.till.total(), 50)

    def test_a_deal_quantity_of_zero_is_refused(self):
        """Also the one that divides by zero if it gets through."""
        self.till.set_price("apple", 50)
        self.assertIs(self.till.set_deal("apple", 0, 30), False)
        self.till.scan("apple")
        self.assertEqual(self.till.total(), 50)

    def test_a_free_deal_is_refused(self):
        self.till.set_price("apple", 50)
        self.assertIs(self.till.set_deal("apple", 3, 0), False)
        for _ in range(3):
            self.till.scan("apple")
        self.assertEqual(self.till.total(), 150)

    # --- prices that move ---

    def test_a_new_price_applies_to_what_is_already_in_the_basket(self):
        """The basket holds what was scanned, not what it cost at the time."""
        self.till.set_price("apple", 50)
        for _ in range(2):
            self.till.scan("apple")
        self.till.set_price("apple", 60)
        self.assertEqual(self.till.total(), 120)

    def test_a_new_price_with_a_deal_still_standing(self):
        self.till.set_price("apple", 50)
        self.till.set_deal("apple", 3, 130)
        for _ in range(4):
            self.till.scan("apple")
        self.till.set_price("apple", 60)
        self.assertEqual(self.till.total(), 190)

    def test_a_deal_set_after_scanning_still_applies(self):
        self.till.set_price("apple", 50)
        for _ in range(3):
            self.till.scan("apple")
        self.till.set_deal("apple", 3, 130)
        self.assertEqual(self.till.total(), 130)

    # --- refusals leave nothing behind ---

    def test_a_price_of_zero_is_refused(self):
        self.assertIs(self.till.set_price("apple", 0), False)
        self.assertIs(self.till.scan("apple"), False)

    def test_a_negative_price_is_refused(self):
        self.assertIs(self.till.set_price("apple", -10), False)
        self.assertIs(self.till.scan("apple"), False)

    def test_a_fractional_price_is_refused(self):
        self.assertIs(self.till.set_price("apple", 50.5), False)
        self.assertIs(self.till.scan("apple"), False)

    def test_an_empty_sku_is_refused(self):
        self.assertIs(self.till.set_price("", 50), False)
        self.assertIs(self.till.scan(""), False)
        self.assertEqual(self.till.total(), 0)

    def test_a_refused_price_does_not_replace_a_good_one(self):
        self.till.set_price("apple", 50)
        self.till.set_price("apple", 0)
        self.till.scan("apple")
        self.assertEqual(self.till.total(), 50)

    # --- clearing ---

    def test_clear_empties_the_basket(self):
        self.till.set_price("apple", 50)
        self.till.scan("apple")
        self.till.clear()
        self.assertEqual(self.till.total(), 0)

    def test_clear_keeps_prices_and_deals(self):
        self.till.set_price("apple", 50)
        self.till.set_deal("apple", 3, 130)
        self.till.scan("apple")
        self.till.clear()
        for _ in range(3):
            self.till.scan("apple")
        self.assertEqual(self.till.total(), 130)

    def test_total_can_be_asked_repeatedly_without_changing_anything(self):
        self.till.set_price("apple", 50)
        self.till.scan("apple")
        self.assertEqual(self.till.total(), 50)
        self.assertEqual(self.till.total(), 50)
        self.assertEqual(self.till.total(), 50)

    # --- scale ---

    def test_a_large_basket(self):
        self.till.set_price("apple", 50)
        self.till.set_deal("apple", 3, 130)
        for _ in range(100000):
            self.till.scan("apple")
        # 33333 lots of three at 130, one left at 50
        self.assertEqual(self.till.total(), 33333 * 130 + 50)

    def test_total_after_every_scan_stays_quick(self):
        """A till that re-walks the basket each time is quadratic here."""
        self.till.set_price("apple", 50)
        self.till.set_deal("apple", 2, 90)
        running = 0
        for _ in range(20000):
            self.till.scan("apple")
            running = self.till.total()
        self.assertEqual(running, 10000 * 90)

    def test_many_skus(self):
        for index in range(1000):
            self.till.set_price("sku-%d" % index, index + 1)
            self.till.scan("sku-%d" % index)
        self.assertEqual(self.till.total(), sum(range(1, 1001)))


if __name__ == "__main__":
    unittest.main()
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