摘要: Given a target integer T, a non-negative integer K and an integer array A sorted in ascending order, find the K closest numbers to T in A. Assumptions 阅读全文
posted @ 2018-03-31 23:38 davidnyc 阅读(190) 评论(0) 推荐(0)
摘要: 做图的时候千万要小心,如果 当前点的邻居已经访问过了, 则不要再放入queue 中 否则一定死循环 所以图的 bfs 一定要 用一个字典来mark 访问过的点 阅读全文
posted @ 2018-03-31 22:26 davidnyc 阅读(188) 评论(0) 推荐(0)
摘要: time o(n)--每一个点都要遍历 space o(1) 阅读全文
posted @ 2018-03-31 21:46 davidnyc 阅读(159) 评论(0) 推荐(0)
摘要: Find the target key K in the given binary search tree, return the node that contains the key if K is found, otherwise return null. 对于 tail recursion 的 阅读全文
posted @ 2018-03-31 06:29 davidnyc 阅读(127) 评论(0) 推荐(0)