摘要: Given a string s and a string t, check if s is subsequence of t. Given a string s and a string t, check if s is subsequence of t. You may assume that 阅读全文
posted @ 2017-06-13 04:59 安新 阅读(357) 评论(0) 推荐(0) 编辑
摘要: Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Note: You may assume k is always valid, 1 ? k ? BST's 阅读全文
posted @ 2017-06-11 23:24 安新 阅读(203) 评论(0) 推荐(0) 编辑
摘要: Recently I transit to use scala to program. scala is a functional and objected oriented language, but it has seamless java Interoperability (they both 阅读全文
posted @ 2017-06-11 08:26 安新 阅读(201) 评论(0) 推荐(0) 编辑
摘要: Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted i 阅读全文
posted @ 2017-06-10 23:56 安新 阅读(203) 评论(0) 推荐(0) 编辑
摘要: Follow up for H-Index: What if the citations array is sorted in ascending order? Could you optimize your algorithm? Solution: # this is could also be 阅读全文
posted @ 2017-06-10 10:44 安新 阅读(164) 评论(0) 推荐(0) 编辑
摘要: Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index. According 阅读全文
posted @ 2017-06-10 09:02 安新 阅读(163) 评论(0) 推荐(0) 编辑
摘要: Given an unsorted array of integers, find the length of longest increasing subsequence. For example,Given [10, 9, 2, 5, 3, 7, 101, 18],The longest inc 阅读全文
posted @ 2017-06-08 12:16 安新 阅读(277) 评论(0) 推荐(0) 编辑
摘要: Given a set of intervals, for each of the interval i, check if there exists an interval j whose start point is bigger than or equal to the end point o 阅读全文
posted @ 2017-06-05 06:49 安新 阅读(207) 评论(0) 推荐(0) 编辑
摘要: Winter is coming! Your first job during the contest is to design a standard heater with fixed warm radius to warm all the houses. Now, you are given p 阅读全文
posted @ 2017-06-04 12:57 安新 阅读(343) 评论(0) 推荐(0) 编辑