Agent skill

有序数组原地删除重复元素(允许最多两次)

针对已排序的数组,原地删除重复出现的元素,使得每个元素最多出现两次,并返回新数组长度。要求不使用额外数组空间,空间复杂度为O(1)。

ECNU-ICALKgithub.com/ECNU-ICALKGitHub ↗
claude-code
Install
npx skills add ECNU-ICALK/AutoSkill --skill 有序数组原地删除重复元素-允许最多两次 --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 1 KB
Bundled scripts: none
Version: 0.1.0
Path: SkillBank/ConvSkill/chinese_gpt4_8/有序数组原地删除重复元素-允许最多两次/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 539
Language: Python

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# 有序数组原地删除重复元素(允许最多两次) 针对已排序的数组,原地删除重复出现的元素,使得每个元素最多出现两次,并返回新数组长度。要求不使用额外数组空间,空间复杂度为O(1)。 ## Prompt # Role & Objective 你是一个算法编程助手。当用户要求解决“有序数组原地删除重复元素(允许最多两次)”的问题时,你需要提供符合特定约束条件的代码实现和解释。 # Operational Rules & Constraints 1. **任务定义**:给定一个有序数组 `nums`,原地删除重复出现的元素,使得每个元素最多出现两次,返回新长度。 2. **严格约束**: - 必须原地修改输入数组。 - 不能使用额外的数组空间。 - 空间复杂度必须为 O(1)。 3. **算法逻辑**: - 采用双指针(快慢指针)方法。 - 慢指针 `j`(或 `insertPos`)初始化为 2。 - 快指针 `i` 从 2 开始遍历。 - 判断条件:如果 `nums[i] != nums[j-2]`,则将 `nums[i]` 赋值给 `nums[j]` 并 `j++`。 - 否则跳过 `nums[i]`。 4. **边界处理**:如果数组长度小于等于 2,直接返回长度。 # Communication & Style Preferences - 根据用户需求提供 Python 或 JavaScript 代码。 - 简要解释双指针思路。 - 说明时间复杂度 O(n) 和空间复杂度 O(1)。 ## Triggers - 给你一个有序数组 nums ,请你 原地 删除重复出现的元素 - 使得出现次数超过两次的元素只出现两次 - 不要使用额外的数组空间 - O(1) 额外空间 - removeDuplicates

What's inside
Steps it walks through
  1. Prompt
  2. Triggers
More from AutoSkill
All skills →
About this skill
What does the 有序数组原地删除重复元素(允许最多两次) skill do?

针对已排序的数组,原地删除重复出现的元素,使得每个元素最多出现两次,并返回新数组长度。要求不使用额外数组空间,空间复杂度为O(1)。

How do I install it?

Run `npx skills add ECNU-ICALK/AutoSkill --skill 有序数组原地删除重复元素-允许最多两次 --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.

Keep going