上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 16 下一页
摘要: 题目: There are N students in a class. Some of them are friends, while some are not. Their friendship is transitive in nature. For example, if A is a di 阅读全文
posted @ 2017-07-27 16:27 荒野第一快递员 阅读(917) 评论(0) 推荐(0) 编辑
摘要: 题目: There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prerequisites, for example to take course 0 you ha 阅读全文
posted @ 2017-07-27 12:39 荒野第一快递员 阅读(687) 评论(0) 推荐(0) 编辑
摘要: 题目: There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prerequisites, for example to take course 0 you ha 阅读全文
posted @ 2017-07-27 10:43 荒野第一快递员 阅读(295) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adj 阅读全文
posted @ 2017-07-26 16:35 荒野第一快递员 阅读(478) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a 2D board containing 'X' and 'O' (the letter O), capture all regions surrounded by 'X'. A region is captured by flipping all 'O's into 'X's 阅读全文
posted @ 2017-07-26 14:14 荒野第一快递员 阅读(287) 评论(0) 推荐(0) 编辑
摘要: 题目: Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. OJ's undirected graph serialization: Nodes are lab 阅读全文
posted @ 2017-07-25 10:47 荒野第一快递员 阅读(298) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. 题意及分析:将一个升序链表转化为平衡二叉搜索树。根据平衡二叉搜索树的定义 阅读全文
posted @ 2017-07-25 09:41 荒野第一快递员 阅读(462) 评论(0) 推荐(0) 编辑
摘要: 题目: Invert a binary tree. to 题意及分析:给出一棵二叉树,对每个节点交换左右子树。对于一个需要交换的节点有三种情况:(1)有左子树,无右子树;(2)有右子树,无左子树;(3)左右子树都有;对着三种情况分别交换左右子树,然后继续对子树递归即可得到结果。 代码: 阅读全文
posted @ 2017-07-25 08:46 荒野第一快递员 阅读(255) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a complete binary tree, count the number of nodes. Definition of a complete binary tree from Wikipedia:In a complete binary tree every level 阅读全文
posted @ 2017-07-24 21:58 荒野第一快递员 阅读(227) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. For 阅读全文
posted @ 2017-07-24 20:17 荒野第一快递员 阅读(166) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 16 下一页