2015年3月24日

Insertion Sort List

摘要: Sort a linked list using insertion sort.思路一:使用一个dummy node,将就的节点插入到新的链表中即可。 1 public ListNode insertionSortList(ListNode head) { 2 ListNode du... 阅读全文

posted @ 2015-03-24 17:00 绿树荫 阅读(175) 评论(0) 推荐(1) 编辑

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],... 阅读全文

posted @ 2015-03-24 16:38 绿树荫 阅读(171) 评论(0) 推荐(1) 编辑

Binary Search Tree Iterator

摘要: Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Callingnext()will return the next... 阅读全文

posted @ 2015-03-24 15:27 绿树荫 阅读(125) 评论(0) 推荐(1) 编辑

Longest Valid Parentheses

摘要: Given a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring.For"(()", the longest... 阅读全文

posted @ 2015-03-24 09:52 绿树荫 阅读(118) 评论(0) 推荐(1) 编辑

导航