当前位置:网站首页>Leetcode203 remove linked list elements
Leetcode203 remove linked list elements
2022-07-01 18:47:00 【It was the sea】

# 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
边栏推荐
- R语言caTools包进行数据划分、scale函数进行数据缩放、class包的knn函数构建K近邻分类器、table函数计算混淆矩阵
- How to operate technology related we media well?
- A wonderful time to buy and sell stocks
- Vidéos courtes recommandées chaque semaine: méfiez - vous de la confusion entre « phénomène » et « problème »
- Rust language - cargo, crates io
- 创建您自己的NFT集合并发布一个Web3应用程序来展示它们(介绍)
- 主成分计算权重
- How to find the optimal learning rate
- GAMES202作业0-环境搭建过程&解决遇到的问题
- After studying 11 kinds of real-time chat software, I found that they all have these functions
猜你喜欢

1380. Lucky number in matrix / 1672 Total assets of the richest customers

What impact will multinational encryption regulation bring to the market in 2022

Livedata postvalue will "lose" data

用GSConv+Slim Neck改进Yolov5,将性能提升到极致!

用WPF写一款开源方便、快捷的数据库文档查询、生成工具

Basic knowledge and commands of disk

Leetcode-83 删除排序链表中重复的元素

Find all missing numbers in the array

Android development interview was badly hit in 3 years, and now the recruitment technical requirements are so high?

创建您自己的NFT集合并发布一个Web3应用程序来展示它们(介绍)
随机推荐
The R language cartools package divides the data, the scale function scales the data, the KNN function of the class package constructs the k-nearest neighbor classifier, and the table function calcula
12种数据量纲化处理方式
MySQL connection tools
R语言使用dplyr包的transmute函数计算dataframe数据中的指定数据列的移动窗口均值、使用ggplot2包可视化移动均值与原始数据的折线图
Cloud computing - make learning easier
C operator overloads the query table
Depth first search - DFS (burst search)
OpenAI|视频预训练 (VPT):基于观看未标记的在线视频的行动学习
LeetCode 148. Sort linked list
How to manage 1000 anchors by one person?
每周推薦短視頻:警惕“現象”與“問題”相互混淆
如何运营好技术相关的自媒体?
12. Design of power divider for ads usage record
Is the fund of futures account safe? How to open an account?
Navicat Premium 15 永久破解和2021版本最新IDEA破解(亲测有效)
字节跳动数据平台技术揭秘:基于 ClickHouse 的复杂查询实现与优化
力扣每日一题-第32天-589.N×树的前序遍历
PTA year of birth
[source code analysis] model parallel distributed training Megatron (5) -- pipestream flush
为什么独立站卖家都开始做社交媒体营销?原来客户转化率能提高这么多!