码迷,mamicode.com
首页 >  
搜索关键字:two pointer    ( 13796个结果
leetcode--Gray Code
The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integernrepresenting the total number...
分类:其他好文   时间:2014-06-10 00:01:38    阅读次数:392
leetcode——Two Sum 两数之和(AC)
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 the two numbers such that they add up to the target, whe...
分类:其他好文   时间:2014-06-09 23:14:45    阅读次数:264
iOS开发 - "Cast from pointer to smaller type 'int' loses information” 解决办法
今天要写一个联系人搜索算法。百度了下, 在code4App中找到相关代码。但是自己跑了下, 发现报错。错误内容如下:"Cast from pointer to smaller type 'int' loses information” 从错误内容我们也能看出, 错误出在'int'这里了。而那份代码也比较早的, 在Xcode5.1之后, 要用uintptr_t来替代int。把错误语句处的int全换成...
分类:移动开发   时间:2014-06-08 18:28:25    阅读次数:429
malloc()参数为0的情况
下面的代码片段输出是什么?为什么? char *ptr; if((ptr = (char *)malloc(0))==NULL) puts("Got a null pointer"); else puts("Got a valid pointer");  解析:......故意把0值传给了函数malloc,得到了一个合法的指针,这就是上面的代码,该代码的输出是"Got ...
分类:其他好文   时间:2014-06-08 17:11:28    阅读次数:285
Recover Binary Search Tree
题目 Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. Note: A solution using O(n) space is pretty straight forward. Cou...
分类:其他好文   时间:2014-06-08 15:32:45    阅读次数:245
leetcode——Add Two Numbers 两个链表表示的正整数对其求和(AC)
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link...
分类:其他好文   时间:2014-06-08 15:30:28    阅读次数:227
一入python深似海--函数与文件
先上写干货,几个开源网站: github.com launchpad.netgitorious.orgsourceforge.netfreecode.com 今天介绍一下python函数和文件读写的知识。 函数 def print_two(*args):#That tells Python to take all the arguments to the function a...
分类:编程语言   时间:2014-06-08 10:37:23    阅读次数:277
leetcode--Combinations
Given two integersnandk, return all possible combinations ofknumbers out of 1 ...n.For example,Ifn= 4 andk= 2, a solution is:[ [2,4], [3,4], [2,3],...
分类:其他好文   时间:2014-06-08 08:08:29    阅读次数:294
LeetCode——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 the two numbers such that they add up to the target, whe...
分类:其他好文   时间:2014-06-08 02:12:04    阅读次数:216
LeetCode: Container With Most Water 题解
Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoints of ...
分类:其他好文   时间:2014-06-07 23:03:35    阅读次数:279
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!