一、原题 Clone an undirected graph. Each node in the graph contains alabeland a list of itsneighbors. OJ's undirected graph serialization: Nodes are labeled uniquely. We use#as a separator for each node,

LeetCode   java   DFS   BFS  

一、原题 There are N gas stations along a circular route, where the amount of gas at station i isgas[i]. You have a car with an unlimited gas tank and it costscost[i]of gas to travel from station i to its

java   LeetCode  

一、原题 There are N children standing in a line. Each child is assigned a rating value. You are giving candies to these children subjected to the following requirements: Each child must have at least one

LeetCode   java   小朋友分糖  

一、原题 Given an array of integers, every element appears three times except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without us

LeetCode   java   位与  

一、原题 A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep copy of the list. 一、中文 链表的每个元素不仅有指向下一个结点的指针,还包括了一

LeetCode   java   单链表   深拷贝  

一、原题 Given preorder and inorder traversal of a tree, construct the binary tree.  Note:  You may assume that duplicates do not exist in the tree.  一、中文 一种是根据前序和中序来构建二叉树,一种是根据中序和后序来构建二叉树 三、举例 (1)给出先序遍历的

LeetCode   二叉树   遍历  

一、原题 Given a binary tree, determine if it is height-balanced.  For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never di

LeetCode   java   二叉树  

一、原题   Given a binary tree, find its minimum depth.    The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.  一、中文 给定一棵两叉树求树的最小深度。  三、举例 也就

二叉树   LeetCode  

一、原题 Given a binary tree, return the level order traversal of its nodes’ values. (ie, from left to right, level by level).  For example:  Given binary tree {3,9,20,#,#,15,7}, 3 / \ 9 20 / \ 15 7 1

遍历   LeetCode   java  

一、原题   Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).    For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \ 3 4 4 3 1 2 3 4 5

LeetCode   二叉树  
1 2 3 4 5