上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 46 下一页

2014年12月23日

Majority Element

摘要: Majority ElementGiven an array of sizen, find the majority element. The majority element is the element that appears more than⌊ n/2 ⌋times.You may ass... 阅读全文

posted @ 2014-12-23 14:34 luckygxf 阅读(162) 评论(0) 推荐(0) 编辑

2014年12月21日

Longest Palindromic Substring

摘要: Longest Palindromic SubstringGiven a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there... 阅读全文

posted @ 2014-12-21 22:21 luckygxf 阅读(130) 评论(0) 推荐(0) 编辑

Excel Sheet Column Title

摘要: Excel Sheet Column TitleGiven a non-zero positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A ... 阅读全文

posted @ 2014-12-21 00:06 luckygxf 阅读(233) 评论(0) 推荐(0) 编辑

2014年12月18日

Find Peak Element

摘要: Find Peak ElementA peak element is an element that is greater than its neighbors.Given an input array wherenum[i] ≠ num[i+1], find a peak element and ... 阅读全文

posted @ 2014-12-18 19:46 luckygxf 阅读(163) 评论(0) 推荐(0) 编辑

Surrounded Regions

摘要: Surrounded RegionsGiven a 2D board containing'X'and'O', capture all regions surrounded by'X'.A region is captured by flipping all'O's into'X's in that... 阅读全文

posted @ 2014-12-18 00:03 luckygxf 阅读(153) 评论(0) 推荐(0) 编辑

2014年12月16日

Compare Version Numbers

摘要: Compare Version NumbersCompare two version numbersversion1andversion1.Ifversion1>version2return 1, ifversion1 Integer.valueOf(ver2_ch[i]))10 ... 阅读全文

posted @ 2014-12-16 20:29 luckygxf 阅读(263) 评论(0) 推荐(0) 编辑

Two Sum

摘要: Two SumGiven 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... 阅读全文

posted @ 2014-12-16 10:39 luckygxf 阅读(182) 评论(0) 推荐(0) 编辑

2014年12月14日

Sort List

摘要: Sort ListSort a linked list inO(nlogn) time using constant space complexity.这道题我想过用直接插入,超时了。百度了一下,用的是归并排序,排序以前用的都是数组,这次用链表,不太习惯参考:http://blog.csdn.net... 阅读全文

posted @ 2014-12-14 23:13 luckygxf 阅读(173) 评论(0) 推荐(0) 编辑

2014年12月12日

Populating Next Right Pointers in Each Node

摘要: Populating Next Right Pointers in Each NodeGiven a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLi... 阅读全文

posted @ 2014-12-12 22:47 luckygxf 阅读(199) 评论(0) 推荐(0) 编辑

Flatten Binary Tree to Linked List

摘要: Flatten Binary Tree to Linked ListGiven a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / ... 阅读全文

posted @ 2014-12-12 21:31 luckygxf 阅读(159) 评论(0) 推荐(0) 编辑

上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 46 下一页

导航