当前位置:网站首页>leetcode:27. 移除元素【count remove小操作】
leetcode:27. 移除元素【count remove小操作】
2022-04-23 01:55:00 【白速龙王的回眸】

分析
用count统计一下相等的个数
然后remove掉
ac code
class Solution:
def removeElement(self, nums: List[int], val: int) -> int:
for i in range(nums.count(val)):
nums.remove(val)
return len(nums)
总结
简单模拟
版权声明
本文为[白速龙王的回眸]所创,转载请带上原文链接,感谢
https://bridge-killer.blog.csdn.net/article/details/124357520
边栏推荐
- Analyze the advantages and disadvantages of tunnel proxy IP.
- Chapter 6 uses Matplotlib to draw thermodynamic diagram
- PID refinement
- Shardingsphere introduction and sub table usage
- 2022.4.10-----leetcode. eight hundred and four
- C语言中如何“指名道姓”的进行初始化
- RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimensio
- [experience tutorial] Alipay balance automatically transferred to the balance of treasure how to set off, cancel Alipay balance automatically transferred to balance treasure?
- npm——配置淘宝镜像
- Technology cloud report: cloud computing has entered the "second half". Where is the way out for domestic cloud?
猜你喜欢

How to choose a good dial-up server?

如何选择一台好的拨号服务器?
![App optimization and advanced scoreboard Part 2 [Mui + flask + mongodb]](/img/86/77b67fd28d2583e12f397430a9a62a.png)
App optimization and advanced scoreboard Part 2 [Mui + flask + mongodb]

C语言中如何“指名道姓”的进行初始化

搭建网站是用物理机还是云主机好?

42、使用mmrotate中k3det进行旋转目标检测,并进行mnn部署和ncnn部署

搭建个人主页保姆级教程(二)

2022第六季完美童模 IPA國民賽領跑元宇宙賽道

What is a dial-up server and what is its use?

42. Use k3det in mmrotate for rotating target detection, MNN deployment and ncnn deployment
随机推荐
W801 / w800 WiFi socket development (I) - UDP
有哪些业务会用到物理服务器?
PID精讲
K zeros after leetcode factorial function
Solve the problem when installing MySQL
2022.4.20-----leetcode. three hundred and eighty-eight
在使用代理IP前需要了解哪些分类?
Shardingsphere broadcast table and binding table
关于C4D动画如何导入Lumion
如何设置电脑ip?
Chapter 6 uses Matplotlib to draw thermodynamic diagram
如何对代理IP进行分类?
The sixth season of 2022, the perfect children's model IPA national race leads the yuanuniverse track
W801/W800-wifi-socket开发(一)-UDP
Analyze the advantages and disadvantages of tunnel proxy IP.
How to set computer IP?
Shardingsphere read write separation
Digital collection platform settled in digital collection platform to develop SaaS platform of digital collection
如何选择一台好的拨号服务器?
搭建网站是用物理机还是云主机好?