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/build-order/reference.py
View on GitHub"""Reference solution for Build Order.
Never copied into a session workspace.
Kahn's algorithm with a sorted ready set. The ready set is kept as a heap so the
alphabetically first available task is always the next one out.
"""
import heapq
def solve(tasks, requirements):
known = set(tasks)
dependents = dict((task, []) for task in tasks)
blocked_by = dict((task, 0) for task in tasks)
seen_pairs = set()
for before, after in requirements:
if before not in known or after not in known:
continue
if (before, after) in seen_pairs:
continue
seen_pairs.add((before, after))
dependents[before].append(after)
blocked_by[after] += 1
ready = [task for task in tasks if blocked_by[task] == 0]
heapq.heapify(ready)
order = []
while ready:
task = heapq.heappop(ready)
order.append(task)
for follower in dependents[task]:
blocked_by[follower] -= 1
if blocked_by[follower] == 0:
heapq.heappush(ready, follower)
if len(order) != len(tasks):
return []
return order
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 |