2014年4月17日

Linked List Cycle II -LeetCode

摘要: Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without using extra space?思路:... 阅读全文

posted @ 2014-04-17 05:30 iisahu 阅读(154) 评论(0) 推荐(0)

Generate Parentheses - LeetCode

摘要: Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is:"((()))... 阅读全文

posted @ 2014-04-17 05:11 iisahu 阅读(126) 评论(0) 推荐(0)

2014年4月15日

Climbing Stairs-LeetCode

摘要: You are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb... 阅读全文

posted @ 2014-04-15 04:36 iisahu 阅读(117) 评论(0) 推荐(0)

Single Number II

摘要: Given an array of integers, every element appearsthreetimes except for one. Find that single one.Note:Your algorithm should have a linear runtime comp... 阅读全文

posted @ 2014-04-15 04:31 iisahu 阅读(91) 评论(0) 推荐(0)

Roman to Integer - LeetCode

摘要: Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.首先要知道罗马数字的规律。 罗马数字对应阿拉伯数字有两种情况:1.用两个字符来表示一个数... 阅读全文

posted @ 2014-04-15 03:57 iisahu 阅读(124) 评论(0) 推荐(0)

Remove Duplicates from Sorted List -LeetCode

摘要: Given a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given1->1->2, return1->2.Given1->1->2->3->3, retu... 阅读全文

posted @ 2014-04-15 02:56 iisahu 阅读(113) 评论(0) 推荐(0)

Search Insert Position - LeetCode

摘要: Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or... 阅读全文

posted @ 2014-04-15 02:47 iisahu 阅读(135) 评论(0) 推荐(0)

2014年4月14日

Populating Next Right Pointers in Each Node - LeetCode

摘要: Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointe... 阅读全文

posted @ 2014-04-14 10:02 iisahu 阅读(116) 评论(0) 推荐(0)

Binary Tree Inorder Traversal - LeetCode

摘要: Given a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,3,2].Note... 阅读全文

posted @ 2014-04-14 09:55 iisahu 阅读(129) 评论(0) 推荐(0)

导航