上一页 1 2 3 4 5 6 7 ··· 13 下一页
摘要: 做图的时候千万要小心,如果 当前点的邻居已经访问过了, 则不要再放入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)
摘要: Implement an iterative, in-order traversal of a given binary tree, return the list of keys of each node in the tree as it is in-order traversed. Examp 阅读全文
posted @ 2018-03-30 23:07 davidnyc 阅读(148) 评论(0) 推荐(0)
摘要: Implement an iterative, pre-order traversal of a given binary tree, return the list of keys of each node in the tree as it is pre-order traversed. Exa 阅读全文
posted @ 2018-03-30 22:11 davidnyc 阅读(214) 评论(0) 推荐(0)
摘要: Insert a new element at a specific index in the given linked list. The index is 0 based, and if the index is out of the list's scope, you do not need 阅读全文
posted @ 2018-03-29 12:52 davidnyc 阅读(214) 评论(0) 推荐(0)
摘要: Given a matrix of size N x M. For each row the elements are sorted in ascending order, and for each column the elements are also sorted in ascending o 阅读全文
posted @ 2018-03-29 12:28 davidnyc 阅读(115) 评论(0) 推荐(0)
摘要: Find the K smallest numbers in an unsorted integer array A. The returned numbers should be in ascending order. Assumptions A is not nullK is >= 0 and 阅读全文
posted @ 2018-03-29 10:45 davidnyc 阅读(170) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/binary-tree-level-order-traversal/description/ Given a binary tree, return the level order traversal of its nodes' value 阅读全文
posted @ 2018-03-29 09:57 davidnyc 阅读(93) 评论(0) 推荐(0)
摘要: Given a sorted array and a target value, return the index where it would be if it were inserted in order. AssumptionsIf there are multiple elements wi 阅读全文
posted @ 2018-03-29 02:10 davidnyc 阅读(149) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 ··· 13 下一页