Leetcode237: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.
* struct ListNode {
* int val;
* struct ListNode *next;
* };
*/
void deleteNode(struct ListNode* node) {
if(node == NULL)
{
return;
}
node->val = node->next->val;
node->next = node->next->next;
}
Leetcode237:Delete Node in a Linked List的更多相关文章
- leetcode: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 th ...
- LeetCode OJ: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 th ...
- Leetcode-237 Delete Node in a Linked List
#237. Delete Node in a Linked List Write a function to delete a node (except the tail) in a singl ...
- 237. Delete Node in a Linked List(C++)
237. Delete Node in a Linked Lis t Write a function to delete a node (except the tail) in a singly l ...
- [LeetCode] 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 th ...
- 237. Delete Node in a Linked List【easy】
237. Delete Node in a Linked List[easy] Write a function to delete a node (except the tail) in a sin ...
- 【4_237】Delete Node in a Linked List
Delete Node in a Linked List Total Accepted: 48121 Total Submissions: 109297 Difficulty: Easy Write ...
- [CareerCup] 2.3 Delete Node in a Linked List 删除链表的节点
2.3 Implement an algorithm to delete a node in the middle of a singly linked list, given only access ...
- 【LeetCode】237 & 203 - Delete Node in a Linked List & Remove Linked List Elements
237 - Delete Node in a Linked List Write a function to delete a node (except the tail) in a singly l ...
随机推荐
- 相对定位、绝对定位在IE6的问题
注意: 关于绝对定位,在IE6下定位元素的父级宽高都为奇数那么在IE6下定位元素的right,bottom都有一像素的偏差(left,top无偏差).因此应尽量使用偶数. 关于绝对定位,在IE6下父级 ...
- Warning: Using innodb_additional_mem_pool_size is DEPRECATED
Warning: Using innodb_additional_mem_pool_size is DEPRECATED. This option may be removed in future r ...
- erl_0013 erlang 带参数模块 parameterized modules are no longer supported
code: -module(mod_test, [Name]). -export([show/0]). show() -> io:format("show:~p~n",[Na ...
- dede调用第一张大图,非缩略图
1.找到include/extend.func.php加入现在函数 function firstimg($str_pic) { $str_sub=substr($str_pic,0,-7)." ...
- int (*(*fp)(void *))[10]; 指向函数的指针类型
<pre lang="c" escaped="true">int (*(*fp)(void *))[10]; //这个类型用typedef分解出来 ...
- LOL-无双剑姬我的最爱
LOL打了几年了,是一种娱乐的好方式,但是一个人玩不开黑就很无聊.这游戏最开始我玩的时候无论是赢是输就无所谓的,很高兴的.但是现在输了反而很气愤.也不知道为什么,所以很少玩了. 剑姬对反甲:如果对方出 ...
- iOS NSString的常用用法
//1.创建常量字符串. NSString *astring = @"This is a String!"; //2.创建空字符串,给予赋值. NSString *astrin ...
- OpenLayers调用arcgis server发布的地图服务
有两种方式可以调用arcgis server发布的地图服务,一种是rest,一种是wms. 地图的投影为900913,arcgis server为10.0版本,地图服务的空间参考为3857. 与 ...
- PHP Header 缓存 --- Header 参数说明
1. Accept:告诉WEB服务器自己接受什么介质类型,*/* 表示任何类型,type/* 表示该类型下的所有子类型,type/sub-type. 2. Accept-Charset: 浏览器申 ...
- 设置VMWARE通过桥接方式使用主机无线网卡上网(zz)
环境:WIN7旗舰版,台式机,U盘无线上网卡. 虚拟软件:VMware9.0,虚拟系统:CentOS6.4 需要实现虚拟机以独立机形式工作和上网. 先介绍一下VMware网络设置的三种方式 1 Hos ...