当前位置:网站首页>Leetcode203 移除链表元素
Leetcode203 移除链表元素
2022-07-01 18:33:00 【原来是大海】
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution(object):
def removeElements(self, head, val):
"""
:type head: ListNode
:type val: int
:rtype: ListNode
"""
chushihua = ListNode(-1)
chushihua.next = head
new = chushihua
while new.next:
if new.next.val == val:
new.next = new.next.next
else:
new = new.next
return chushihua.next
边栏推荐
- Leetcode 1380. Lucky numbers in the matrix (save the minimum number of each row and the maximum number of each column)
- Apache iceberg source code analysis: schema evolution
- Highly reliable program storage and startup control system based on anti fuse FPGA and QSPI flash
- Leetcode problem solving series -- continuous positive sequence with sum as s (sliding window)
- Data query language (DQL)
- This is the latest opportunity of the London bank trend
- Convert the robot's URDF file to mujoco model
- Mysql database design
- JS how to convert a string with a delimiter into an n-dimensional array
- MySQL connection tools
猜你喜欢
What are the legal risks of NFT brought by stars such as curry and O'Neill?
Mujoco XML modeling
Nearly 60% of the employees strongly support Ctrip's "3+2" working mode, and work at home for two days a week
Computer network interview assault
必看,时间序列分析
Relational database management system of easyclick
[today in history] February 15: Pascal's father was born; YouTube was founded; Kotlin language comes out
Apache iceberg source code analysis: schema evolution
因子分析怎么计算权重?
Record 3 - the state machine realizes key control and measures the number of external pulses
随机推荐
Distributed task queue: Celery usage record
Static timing analysis (STA) in ic/fpga design
Easycvr accesses the equipment through the national standard gb28181 protocol. What is the reason for the automatic streaming of the equipment?
[CF1476F]Lanterns
Redis master-slave realizes 10 second check and recovery
SPIE Western optoelectronics exhibition returned offline and successfully held a science and engineering event
How to learn automated testing?
L'ouverture d'un compte d'actions en ligne est - elle sécurisée? Fiable?
Mysql database of easyclick
网上股票开户安全吗?是否可靠?
Growing up in the competition -- (Guangyou's most handsome cub) Pikachu walking
Set the style of QT property sheet control
Cloud picture says | distributed transaction management DTM: the little helper behind "buy buy buy"
Database - MySQL advanced SQL statement (I)
LeetCode 148. Sort linked list
Blue Bridge Cup real question: score statistics
Depth first search - DFS (burst search)
Force buckle day33
Detailed explanation of select in golang
. Net cloud native architect training camp (permission system code implements actionaccess) -- learning notes