上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 43 下一页

2015年10月4日

32. Longest Valid Parentheses (Stack; DP)

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

posted @ 2015-10-04 10:05 joannae 阅读(178) 评论(0) 推荐(0) 编辑

71. Simplify Path (Stack)

摘要: Given an absolute path for a file (Unix-style), simplify it. For example, path = "/home/", => "/home" path = "/a/./b/../../c/", => "/c" 注意:题目中已限定是abso 阅读全文

posted @ 2015-10-04 07:59 joannae 阅读(166) 评论(0) 推荐(0) 编辑

2015年10月3日

Leetcode catalogue

摘要: 1. Array & List 1.1Sort Array的变更操作,好好运用尾指针:88题的end,75题的blueHead 88. Merge Sorted Array (Array) 75. Sort Colors 21. Merge Two Sorted Lists 23. Merge k 阅读全文

posted @ 2015-10-03 19:39 joannae 阅读(181) 评论(0) 推荐(0) 编辑

145. Binary Tree Postorder Traversal (Stack, Tree)

摘要: Given a binary tree, return the postorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, return [3,2,1]. Note: Recursive so 阅读全文

posted @ 2015-10-03 17:34 joannae 阅读(216) 评论(0) 推荐(0) 编辑

144. Binary Tree Preorder Traversal (Tree, Stack)

摘要: 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 @ 2015-10-03 17:30 joannae 阅读(180) 评论(0) 推荐(0) 编辑

114. Flatten Binary Tree to Linked List (Stack, Tree; DFS)

摘要: Given a binary tree, flatten it to a linked list in-place. For example, Given The flattened tree should look like: 法I:递归,前序遍历 法II:迭代 每次循环,找到左子树前序遍历的最后 阅读全文

posted @ 2015-10-03 17:27 joannae 阅读(178) 评论(0) 推荐(0) 编辑

146. LRU Cache (List, HashTable)

摘要: Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set. get(key) - Get the 阅读全文

posted @ 2015-10-03 16:05 joannae 阅读(249) 评论(0) 推荐(0) 编辑

142. Linked List Cycle II (List; Two-Pointers)

摘要: Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Note: Do not modify the linked list. Follow up:Can you ... 阅读全文

posted @ 2015-10-03 15:55 joannae 阅读(145) 评论(0) 推荐(0) 编辑

141. Linked List Cycle (List; Two-Pointers)

摘要: Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using extra space?思路:采用“快慢指针”查检查链表是否含有环。让一个指针一次走一步,另一个一次走两步... 阅读全文

posted @ 2015-10-03 15:53 joannae 阅读(143) 评论(0) 推荐(0) 编辑

125. Valid Palindrome (Array; Two-Pointers)

摘要: Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example,"A man, a plan, a canal: Pan... 阅读全文

posted @ 2015-10-03 15:41 joannae 阅读(146) 评论(0) 推荐(0) 编辑

上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 43 下一页

导航