摘要: Given a binary tree, find the length of the longest consecutive sequence path. The path refers to any sequence of nodes from some starting node to any 阅读全文
posted @ 2017-12-20 06:56 逸朵 阅读(128) 评论(0) 推荐(0)
摘要: Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijection between a lette 阅读全文
posted @ 2017-12-20 06:17 逸朵 阅读(162) 评论(0) 推荐(0)
摘要: 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 @ 2017-12-20 05:36 逸朵 阅读(164) 评论(0) 推荐(0)
摘要: Given an unsorted array nums, reorder it in-place such that nums[0] <= nums[1] >= nums[2] <= nums[3].... For example, given nums = [3, 5, 2, 1, 6, 4], 阅读全文
posted @ 2017-12-20 04:59 逸朵 阅读(115) 评论(0) 推荐(0)
摘要: Suppose you are at a party with n people (labeled from 0 to n - 1) and among them, there may exist one celebrity. The definition of a celebrity is tha 阅读全文
posted @ 2017-12-20 04:48 逸朵 阅读(178) 评论(0) 推荐(0)
摘要: Design an algorithm to encode a list of strings to a string. The encoded string is then sent over the network and is decoded back to the original list 阅读全文
posted @ 2017-12-20 04:33 逸朵 阅读(136) 评论(0) 推荐(0)
摘要: 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 @ 2017-12-20 03:49 逸朵 阅读(194) 评论(0) 推荐(0)
摘要: 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 @ 2017-12-20 03:23 逸朵 阅读(316) 评论(0) 推荐(0)
摘要: Given a string s, return all the palindromic permutations (without duplicates) of it. Return an empty list if no palindromic permutation could be form 阅读全文
posted @ 2017-12-20 03:07 逸朵 阅读(285) 评论(0) 推荐(0)
摘要: There are a row of n houses, each house can be painted with one of the k colors. The cost of painting each house with a certain color is different. Yo 阅读全文
posted @ 2017-12-20 01:51 逸朵 阅读(115) 评论(0) 推荐(0)