Search on monotonic predicates for sorted arrays, answer spaces, and rotated arrays. Use when finding minimum/maximum values, insertion points, or solving 'minimize the maximum' problems.
Scanned 9/7/2026
Install to Claude Code
npx -y skills add knoopx/pi --skill binary-search --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Binary Search?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/knoopx-binary-search)More formats (shields.io, HTML) on the badges page.
---
name: binary-search
description: "Search on monotonic predicates for sorted arrays, answer spaces, and rotated arrays. Use when finding minimum/maximum values, insertion points, or solving 'minimize the maximum' problems."
topic: Binary Search
token_cost: 90
related: [sorting-choice, two-pointers, hash-vs-tree]
keywords:
[
binary,
search,
sorted,
monotonic,
bisect,
minimum,
maximum,
feasible,
predicate,
lower,
upper,
bound,
log,
efficient,
mid,
pivot,
rotated,
]
---
## When to use
Binary search works on any monotonic predicate, not just sorted arrays. Pattern: "find minimum X such that condition(X) is true" — binary search on the answer space.
## Rules
- Use bisect.bisect_left/bisect_right for sorted-array insertion points
- For "minimize the maximum" or "maximize the minimum" problems, binary search on the answer and check feasibility
- ALWAYS use lo + (hi - lo) // 2 to avoid overflow
- When searching rotated arrays, check which half is sorted first
- NEVER binary search on unsorted data without a monotonic predicate
## Complexity
Time: O(log n) — whenever you see "sorted" or "monotonic" in a problem, consider binary search.
## Example
"Minimize maximum load" → binary search on answer space. Check if `feasible(mid)` divides into k groups each ≤ mid. Use `lo + (hi - lo) // 2` to avoid overflow.
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!
Use this skill when developing or maintaining browser extension code in the `browser/` directory, including Chrome/Firefox/Edge compatibility, content scripts, background scripts, or i18n updates.
SEO optimization with keyword analysis, readability assessment, technical validation, content quality. Use for search rankings, blog posts, content audits, or encountering keyword density, readability scores, meta tags, schema markup errors.
Official Google SEO guide covering search optimization, best practices, Search Console, crawling, indexing, and improving website search visibility based on official Google documentation
Python backend development expertise for FastAPI, security patterns, database operations, Upstash integrations, and code quality. Use when: (1) Building REST APIs with FastAPI, (2) Implementing JWT/OAuth2 authentication, (3) Setting up SQLAlchemy/async databases, (4) Integrating Redis/Upstash caching, (5) Refactoring AI-generated Python code (deslopification), (6) Designing API patterns, or (7) Optimizing backend performance.
Build a full-stack TanStack Start app on Cloudflare Workers from scratch — SSR, file-based routing, server functions, D1+Drizzle, better-auth, Tailwind v4+shadcn/ui. Use whenever the user mentions TanStack Start, asks to scaffold a full-stack Cloudflare app with SSR, wants an SSR dashboard, or asks for a React 19 + Cloudflare Workers app with file-based routing and server functions — even if they don't name TanStack Start specifically. No template repo — Claude generates every file fresh per ...