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/run-compression/problem.md
View on GitHub# Run Compression
A logging system squashes repeated characters, but only when squashing actually
saves space.
Write `solve(text)` that returns a compressed version of `text`:
- A run of **three or more** identical characters becomes the character followed
by the run length, so `"aaaa"` becomes `"a4"`.
- A run of one or two characters is left exactly as it is, because `"aa"` is no
longer than `"a2"`.
## Examples
```python
solve("aaabbc")
# "a3bbc"
# The run of three a's compresses. The two b's and single c do not.
solve("aaaaaaaaaaaa")
# "a12"
solve("abc")
# "abc"
solve("aabbbaa")
# "aab3aa"
# Runs are counted separately even when the character comes back later.
solve("")
# ""
```
## Constraints
- `0 <= len(text) <= 100_000`
- Any characters may appear, including digits, spaces, and punctuation.
- The result is a string, and it is not required to be shorter than the input.
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 |