--- title: "What do you notice about the problem?" description: "Tick what you notice about a problem and get the techniques to try, best match first." tool: technique-finder category: Algorithms tags: [tool, algorithms] --- ## What this is for You have a problem and an answer that is too slow, and you do not know which idea to reach for. Tick what you notice. Each thing you notice points at techniques, and the ones pointed at most often come first. **Use it** when you are stuck on how to speed something up. **Skip it** when you already know the technique. ## Try it Tick everything that applies. {{< tool "technique-finder" >}} ## The table This is the same data the tool uses. If the tool does not load, find your row here. | If you notice | Try | |---|---| | The same smaller problem comes up again and again | Memoisation, dynamic programming | | The order of the items matters or could help | Sort first | | You keep asking "have I seen this before?" | Hash set or map | | You need sums or counts over ranges | Prefix sums, difference array | | You are looking for pairs in sorted data | Two pointers | | You are looking at a run of items that must meet a condition | Sliding window | | The answer is feasible up to a point and never after | Binary search on the answer | | The locally best choice seems safe | Greedy, then check the exchange argument | | There are links, dependencies or reachability | Graph model: BFS or DFS, topological sort, union-find | | The structure is nested or hierarchical | Tree, recursion, stack | | n is small and there are choices to make | Backtracking, bitmask | | You always need the smallest or largest so far | Heap, monotonic stack or queue | | The problem splits into independent halves | Divide and conquer | ## For agents Run it from the repository, with no browser. The input lists the ids of the signals that apply (see `signals` in the data file): ```bash node cli.mjs technique-finder '{"signals": ["order", "pairs"]}' ``` The result is JSON: `ok`, `summary`, and `matches`, a list of `{id, label, detail}`. Each match is a technique, ranked by how many of your signals point at it; `detail` names those signals. Ticking nothing, or only unknown ids, gives `ok: false`. The logic is `/tools/technique-finder/logic.mjs` and the data is `/tools/technique-finder/data.json`. Every example in the data file is checked by `npm test`. ## Related - [Problem Solving](https://qref.eknath.dev/skills/problem-solving/): the method this tool belongs to (step 4, find the lever).