10 2016 档案

摘要:Question Given an integer array, find a subarray with sum closest to zero. Return the indexes of the first number and last number. Given [-3, 1, 1, -3 阅读全文
posted @ 2016-10-25 01:19 树獭君 阅读(483) 评论(0) 推荐(0)
摘要:Question Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You m 阅读全文
posted @ 2016-10-23 04:12 树獭君 阅读(187) 评论(0) 推荐(0)
摘要:Question Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.) 阅读全文
posted @ 2016-10-20 12:49 树獭君 阅读(233) 评论(0) 推荐(0)
摘要:从BST中移除一个节点是比较复杂的问题,需要分好几种情况讨论。 如这篇文章,就讨论了删除节点 1.有无左右子树 2.只有右子树 3.只有左子树 三种情况。 一种简单些的思维是只考虑删除节点是否有右子树(因为第一个比删除节点大的节点可能出现在右子树,不会出现在左子树)。 这里用Target表示删除节点 阅读全文
posted @ 2016-10-18 11:03 树獭君 阅读(159) 评论(0) 推荐(0)