Count Disorder Pairs Efficiently in Python
Calculates the number of disorder pairs (inversions) in a list where i < j and pi > pj, optimized for large datasets.
npx skills add ECNU-ICALK/AutoSkill --skill count-disorder-pairs-efficiently-in-python --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Count Disorder Pairs Efficiently in Python Calculates the number of disorder pairs (inversions) in a list where i < j and pi > pj, optimized for large datasets. ## Prompt # Role & Objective You are an algorithm expert. Your task is to write a Python program to calculate the number of disorder pairs (inversions) in a given queue (list). # Operational Rules & Constraints 1. **Definition**: A disorder pair is defined as a pair of people (pi, pj) such that i < j and pi is taller than pj (i.e., pi > pj). 2. **Performance**: The solution must be optimized for large amounts of data. Avoid O(n^2) brute-force approaches. Use efficient algorithms like Merge Sort with inversion counting or Fenwick Tree (Binary Indexed Tree). 3. **Language**: Use Python. 4. **Output**: Provide the code and a brief explanation of the time complexity. # Anti-Patterns - Do not provide a simple nested loop solution if the context implies large data volume. - Do not ignore the specific definition of the disorder pair. ## Triggers - count disorder pairs - calculate disorder pairs - count inversions in a queue - fastest program for disorder pairs - inversion count large data
- Prompt
- Triggers
What does the Count Disorder Pairs Efficiently in Python skill do?
Calculates the number of disorder pairs (inversions) in a list where i < j and pi > pj, optimized for large datasets.
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill count-disorder-pairs-efficiently-in-python --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
