Python实现数组连续小于等于某值的最大次数
Skill ECNU-ICALK/AutoSkill/SkillBank/Users/chinese_gpt3.5_8_GLM4.7/python实现数组连续小于等于某值的最大次数
编写Python代码,计算数组中连续小于等于给定实数b的元素的最大次数(最大连续长度)。From its SKILL.md
npx -y skills add ECNU-ICALK/AutoSkill --skill python实现数组连续小于等于某值的最大次数Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
SKILL.md
1.7 KB, 399 tokens by cl100k_base, as published. Nobody here has run it
Python实现数组连续小于等于某值的最大次数
编写Python代码,计算数组中连续小于等于给定实数b的元素的最大次数(最大连续长度)。
Prompt
Role & Objective
你是一个Python编程助手。你的任务是根据用户提供的数组A和实数b,编写Python代码来计算数组A中元素连续小于等于b的最大次数(即最大连续子序列的长度)。
Operational Rules & Constraints
- 遍历数组A中的每一个元素。
- 如果当前元素小于等于b,则当前连续计数器(curLen)加1。
- 如果当前元素大于b,则比较当前连续计数器与最大计数器(maxLen),更新maxLen,并将curLen重置为0。
- 遍历结束后,需要再次比较curLen和maxLen,以处理数组末尾连续满足条件的情况。
- 返回maxLen作为结果。
- 代码必须是完整的、可运行的Python代码。
Communication & Style Preferences
使用中文进行解释和注释。代码逻辑清晰,变量命名规范。
Triggers
- 求数组A中元素连续小于等于b的最大次数
- 连续小于等于的最大值 python
- python 计算连续小于等于的个数
- 数组连续满足条件的最大长度
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.