摘要: Given n distinct positive integers, integer k (k <= n) and a number target. Find k numbers where sum is target. Calculate how many solutions there are 阅读全文
posted @ 2014-12-24 12:47 LiBlog 阅读(913) 评论(0) 推荐(0) 编辑
摘要: BT(binary tree), want to find the LIS(largest independent set) of the BT. LIS: if the current node is in the set, then its children should not be in t... 阅读全文
posted @ 2014-12-24 07:48 LiBlog 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 假设你是harry potter,在grid的左上角,你现在要走到右下角,grid中有正数也有负数,遇到正数表示你的strength增加那么多,遇到负数表示strength减少那么多,在任何时刻如果你的strength小于等于0,那么你就挂了。在一开始你有一定的初始的strength,现在问这个初始... 阅读全文
posted @ 2014-12-24 06:15 LiBlog 阅读(188) 评论(0) 推荐(0) 编辑
摘要: Given an integer array, adjust each integers so that the difference of every adjcent integers are not greater than a given number target.If the array ... 阅读全文
posted @ 2014-12-24 05:40 LiBlog 阅读(329) 评论(0) 推荐(0) 编辑
摘要: Given an array, determine whether there are three elements A[i],A[j],A[k], such that A[i]A[twoLen]) return true; 9 if (twoLen!=-1 && A[i]>... 阅读全文
posted @ 2014-12-24 04:54 LiBlog 阅读(196) 评论(0) 推荐(0) 编辑