Leetcode no. 237
来源:互联网 发布:cf有刷枪软件吗 编辑:程序博客网 时间:2024/04/29 18:52
237. Delete Node in a Linked List
Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.
Supposed the linked list is 1 -> 2 -> 3 -> 4
and you are given the third node with value 3
, the linked list should become 1 -> 2 -> 4
after calling your function.
/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */public class Solution { public void deleteNode(ListNode node) { node.val= node.next.val; node.next= node.next.next; }}
0 0
- Leetcode no. 237
- LeetCode No.11 ~No.12
- Leetcode NO.78 Subsets
- Leetcode NO.77 Combinations
- Leetcode NO.46 Permutations
- 【leetcode】No. 235 LCABST
- LeetCode no. 35
- Leetcode no. 37
- Leetcode no. 279
- Leetcode no. 335
- Leetcode no. 283
- Leetcode no. 181 (sql)
- Leetcode no. 40
- Leetcode no. 238
- Leetcode no. 26
- Leetcode no. 80
- Leetcode no. 228
- Leetcode no. 313
- GBDT(MART) 迭代决策树入门教程 | 简介
- dwr之session过期
- Android Studio启动虚拟机的时候出现问题Instant Run Requires‘Tools | Android | Enable ADB integration’...
- 单调队列1002 HDU 4122 Alice's mooncake shop 对于学习单调队列的同学不建议做,浪费时间的模拟水题
- docker 简单使用
- Leetcode no. 237
- Linux学习笔记(3) --- Linux常用命令
- 单调队列1003 HDU 3530 Subsequence
- glOrtho()函数和glViewport()函数的理解
- 第十五周项目:程序填空
- 团体程序设计天梯赛-练习集 L2-005
- mysql grant命令
- python偏函数应用
- 《Algorithms》——删除二叉查找树中的结点