Given a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is not a multiple ofkthen left-o...
分类:
其他好文 时间:
2015-07-08 20:24:43
阅读次数:
112
当代码试图访问空指针指向的内存时程序就会崩溃,从而导致鲁棒性问题。所以要对空链表单独处理。
ListNode* Merge(ListNode* pHead1, ListNode* pHead2)
{
if (pHead1 == NULL)
return pHead2;
else if (pHead2 == NULL)
return pHead1;
ListNode* pMergedH...
分类:
编程语言 时间:
2015-07-08 19:01:19
阅读次数:
132
void swap(char* a, char* b){ if(a == 0 || b == 0){ return; } *a = *a ^ *b; *b = *a ^ *b; *a = *a ^ *b;}//假的冒泡排序(沉底排序,不好)char* bub_sort(char* ch, int ....
分类:
编程语言 时间:
2015-07-08 18:49:20
阅读次数:
141
/** * 比较两个指定时间,结果为0 表示相同,< 0 则表示第一个时间早于第二个时间 * @param firstDay * @param secondDay * @return */ public static int compareto(...
分类:
编程语言 时间:
2015-07-08 18:22:11
阅读次数:
123
在iOS中播放视频可以使用MediaPlayer.framework种的MPMoviePlayerController类来完成,它支持本地视频和网络视频播放。这个类实现了MPMediaPlayback协议,因此具备一般的播放器控制功能,例如播放、暂停、停止等。
/**
* 初始化MPMoviePlayerController
*
* @return 返回一个MPMoviePlayerController的实例
*/
- (MPMoviePlayerController *)moviePlayer...
分类:
其他好文 时间:
2015-07-08 16:35:33
阅读次数:
126
Given a string containing only digits, restore it by returning all possible valid IP address combinations.
For example:
Given “25525511135”,
return [“255.255.11.135”, “255.255.111.35”]. (O...
分类:
其他好文 时间:
2015-07-08 16:31:03
阅读次数:
117
1 Two Sum链接:https://leetcode.com/problems/two-sum/
问题描述:
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of t...
分类:
其他好文 时间:
2015-07-08 14:39:14
阅读次数:
131
Maximal RectangleGiven a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.一道超难的题目,思想难,同时实现...
分类:
其他好文 时间:
2015-07-08 14:34:30
阅读次数:
156
Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2->1->4->3.Your algor...
分类:
其他好文 时间:
2015-07-08 14:32:36
阅读次数:
92
二分法, 最后注意一下输出的时候要和 nums[left]比较一下来决定输出多少class Solution: # @param {integer[]} nums # @param {integer} target # @return {integer} def search...
分类:
其他好文 时间:
2015-07-08 14:25:09
阅读次数:
94