题目链接题意:给出一个以数组形式表示的数, 求该数加1后的结果,同样以数组形式返回。附上代码: 1
class Solution { 2 public: 3 vector plusOne(vector &digits) { 4 unsigned int
len = digit...
分类:
其他好文 时间:
2014-05-12 12:49:34
阅读次数:
268
class Solution {public: int
maximalRectangle(vector > &matrix) { int rows = matrix.size(); if (rows
== 0) return 0; int cols =...
分类:
其他好文 时间:
2014-05-12 09:54:05
阅读次数:
250
Sort a linked list using insertion
sort.//用到O(N)的额外空间public class Solution { public ListNode
insertionSortList(ListNode head) { if(head==nul...
分类:
其他好文 时间:
2014-05-11 23:59:09
阅读次数:
405
Linuxcomeswithmanytoolstoenableadministratorstoevaluatetheperformanceofasystem.Oneoftheseveryusefultoolsisvmstat.VmstatisavailableonmostunixdistributionsandisincludedbydefaultonmanymodernLinuxdistributions.AswithmostLinuxcommands,builtinhelpisavailableviath..
分类:
系统相关 时间:
2014-05-11 19:39:38
阅读次数:
680
题意:在一组数组中除一个元素外其它元素都出现两次,找出这个元素
思路:位运算。异或。因为异或操作可以交换元素的顺序,所以元素异或的顺序没影响,
最后出现再次的元素都会被异或掉,相当于0和只出现一次的那个元素异或,结果还是那个元素
推广:这个方法也适合于出现其它元素都出现偶数次,而要找的元素出现奇数次的情况
相关题目:Single Number II
class Solution...
分类:
其他好文 时间:
2014-05-11 02:37:42
阅读次数:
397
class Solution {public: ListNode
*insertionSortList(ListNode *head) { if (head == NULL) return NULL; ListNode*
sorted_head = head; ...
分类:
其他好文 时间:
2014-05-10 20:39:14
阅读次数:
419
Given an integer, convert it to a roman
numeral.Input is guaranteed to be within the range from 1 to 3999.public class
Solution { public String int...
分类:
其他好文 时间:
2014-05-10 20:31:10
阅读次数:
335
IOS DEVELOPMENT TIPS & TRICKS - PART
Ihttp://blog.trifork.com/2013/12/19/ios-development-tips-tricks-part-i/As you
might know, I am very fond of devel...
分类:
移动开发 时间:
2014-05-10 09:08:00
阅读次数:
671
InjectionInjection flaws, such as SQL, OS, and
LDAP injection, occur when untrusted data is sent to an interpreter as part of a
command or query. The ...
分类:
移动开发 时间:
2014-05-10 07:23:51
阅读次数:
460
很简单的题目,一次过,注意为数组空的时候,应返回0而非null 1 public class
Solution { 2 public int searchInsert(int[] A, int target) { 3 int i; 4 if
(A.length...
分类:
其他好文 时间:
2014-05-10 06:51:21
阅读次数:
288