摘要: Given an unsorted integer array, find the first missing positive integer.For example, Given [1,2,0] return 3, and [3,4,-1,1] return 2.Your algorithm s... 阅读全文
posted @ 2014-06-12 16:15 Xiang Xiao 阅读(101) 评论(0) 推荐(0)
摘要: Implement strStr().Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack.class Solution {public: ... 阅读全文
posted @ 2014-06-12 14:29 Xiang Xiao 阅读(107) 评论(0) 推荐(0)
摘要: Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximu... 阅读全文
posted @ 2014-06-11 22:28 Xiang Xiao 阅读(133) 评论(0) 推荐(0)
摘要: Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the o... 阅读全文
posted @ 2014-05-23 11:15 Xiang Xiao 阅读(125) 评论(0) 推荐(0)
摘要: Determine whether an integer is a palindrome. Do this without extra space.if use recursive, like check the first dig and last dig, then remove them, c... 阅读全文
posted @ 2014-05-21 21:24 Xiang Xiao 阅读(118) 评论(0) 推荐(0)
摘要: Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.... 阅读全文
posted @ 2014-05-21 20:17 Xiang Xiao 阅读(134) 评论(0) 推荐(0)
摘要: Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth... 阅读全文
posted @ 2014-05-16 10:58 Xiang Xiao 阅读(162) 评论(0) 推荐(0)
摘要: 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 ... 阅读全文
posted @ 2014-05-15 18:37 Xiang Xiao 阅读(125) 评论(0) 推荐(0)
摘要: Given two binary strings, return their sum (also a binary string).For example, a = "11" b = "1" Return "100".string 的操作,短string补位。两个“0”会输出一个“00”,要特殊处理... 阅读全文
posted @ 2014-05-15 13:22 Xiang Xiao 阅读(126) 评论(0) 推荐(0)
摘要: Given a binary tree, return the preorder traversal of its nodes' values.For example: Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,2,3... 阅读全文
posted @ 2014-05-14 20:42 Xiang Xiao 阅读(111) 评论(0) 推荐(0)