上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 21 下一页

2016年7月16日

Minimum Window Substring

摘要: Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). For example,S = "ADOBECOD 阅读全文

posted @ 2016-07-16 23:02 Sheryl Wang 阅读(152) 评论(0) 推荐(0) 编辑

Minimum Size Subarray Sum

摘要: Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum ≥ s. If there isn't one, return 阅读全文

posted @ 2016-07-16 22:16 Sheryl Wang 阅读(177) 评论(0) 推荐(0) 编辑

2016年7月15日

Find Minimum in Rotated Sorted Array II

摘要: Follow up for "Find Minimum in Rotated Sorted Array":What if duplicates are allowed? Would this affect the run-time complexity? How and why? Suppose a 阅读全文

posted @ 2016-07-15 22:16 Sheryl Wang 阅读(138) 评论(0) 推荐(0) 编辑

2016年7月13日

Closest Binary Search Tree Value II

摘要: Given a non-empty binary search tree and a target value, find k values in the BST that are closest to the target. Note: Given target value is a floati 阅读全文

posted @ 2016-07-13 21:59 Sheryl Wang 阅读(284) 评论(0) 推荐(0) 编辑

Closest Binary Search Tree Value

摘要: Given a non-empty binary search tree and a target value, find the value in the BST that is closest to the target. Note: Given target value is a floati 阅读全文

posted @ 2016-07-13 21:30 Sheryl Wang 阅读(216) 评论(0) 推荐(0) 编辑

Find Leaves of Binary Tree

摘要: Given a binary tree, collect a tree's nodes as if you were doing this: Collect and remove all leaves, repeat until the tree is empty. Example:Given bi 阅读全文

posted @ 2016-07-13 21:06 Sheryl Wang 阅读(252) 评论(0) 推荐(0) 编辑

Largest BST Subtree

摘要: Given a binary tree, find the largest subtree which is a Binary Search Tree (BST), where largest means subtree with largest number of nodes in it. Not 阅读全文

posted @ 2016-07-13 10:59 Sheryl Wang 阅读(180) 评论(0) 推荐(0) 编辑

2016年7月11日

Invert Binary Tree

摘要: Invert a binary tree. to 反转二叉树,其实就是自顶向下递归翻转.代码如下: 阅读全文

posted @ 2016-07-11 18:14 Sheryl Wang 阅读(106) 评论(0) 推荐(0) 编辑

Recover Binary Search Tree

摘要: Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. Note: A solution using O(n) space 阅读全文

posted @ 2016-07-11 17:12 Sheryl Wang 阅读(127) 评论(0) 推荐(0) 编辑

Inorder Successor in BST

摘要: Given a binary search tree and a node in it, find the in-order successor of that node in the BST. Note: If the given node has no in-order successor in 阅读全文

posted @ 2016-07-11 15:22 Sheryl Wang 阅读(388) 评论(0) 推荐(0) 编辑

上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 21 下一页

导航