当前位置:网站首页>Leetcode-83- delete duplicate elements in the linked list
Leetcode-83- delete duplicate elements in the linked list
2022-07-18 09:28:00 【z754916067】
subject

Ideas
- Another IQ problem
Code
public ListNode deleteDuplicates(ListNode head) {
// return pre.next.next that will do
ListNode new_node = new ListNode();
ListNode pre = new ListNode(101,new_node);
// Current saved number
int val = 101;
while(head!=null){
if(head.val!=val){
new_node.next = new ListNode(head.val);
val=head.val;
head=head.next;
new_node=new_node.next;
}else head = head.next;
}
return pre.next.next;
}
边栏推荐
- Research on Key Technologies of asset detection in Cyberspace
- Can SQL also play AI? you 're right! Mlops meetup V3 review openmlbd+sqlflow+byzer
- Input device drive process
- DMS如何赋权数据库函数权限呢?
- C#将数据库连接方式写到配置文件中
- Exness: crude oil stopped falling and rebounded. Pay attention to the performance of US terrorist data in the evening
- Codeforces Round #802 A. Optimal Path
- Codeforces Global Round 21 A. NIT orz!
- 学习经验分享之六:干货博士经验分享
- ACL 2022 | 基于阅读理解的论点对抽取
猜你喜欢

响应式织梦模板家居家具建材类网站

Cloud document management software docuware cloud how to solve five it problems

nacos win10单机启动命令

Code forces round # 802 B. Palindromic Numbers

语言AI原来知道自己的回答是否正确!伯克利等高校新研究火了,网友:危险危险危险

Codeforces Round #803 (Div. 2) C. 3SUM Closure

小目标检测2_OHEM

VS2019+CUDA11.1新建项目里没有CUDA选项

Codeforces Round #803 (Div. 2) D. Fixed Point Guessing

怎么解决系统高并发问题的思路?看完你就彻底懂了。
随机推荐
网络可信身份认证
7-Redis架构设计到使用场景-缓存穿透、缓存雪崩、缓存预热、缓存降级
Airiot q.4 | Comment utiliser le moteur d'analyse des données?
PolarDB for PostgreSQL的HTAP(Hybrid Transaction and
In a real case, college students were cheated when taking orders. I hope you won't be cheated [painful lesson]
论文翻译解读:Translating Embeddings for Modeling Multi-relational Data【TransE】
下班前几分钟,我彻底弄懂了JSON.stringify()
[mt2109] rectangle
5个时间序列预测的深度学习模型对比总结:从模拟统计模型到可以预训练的无监督模型
Codeforces Round #806 (Div. 4) A - G
Codeforces Round #802 B. Palindromic Numbers
Grow up Summer Challenge | learn / create from the boss, and get CSDN gift bag, exclusive certificate of honor, commemorative T-shirt and medal!
CVPR 2022 | 提高小数据集利用效率,复旦等提出分层级联ViT网络
卸载CUDA11.1
【MT2109】矩形
Win11提示Outlook搜索错误怎么办?Win11提示Outlook搜索错误
Codeforces Round #804 B Almost Ternary Matrix
我国数据安全治理研究
Is it safe to open an account and speculate in stocks online at present?
Codeforces Global Round 21 B. NIT Destroys the Universe