- 博客(13)
- 收藏
- 关注
转载 338. Counting Bits 仅为学习笔记
Given a non negative integer numbernum. For every numbersiin the range0 ≤ i ≤ numcalculate the number of 1's in their binary representation and return them as an array.Example:Fornum = 5...
2017-10-24 11:40:00 87
转载 105. Construct Binary Tree from Preorder and Inorder Traversal
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 /** 2 * Definition for a binary tree nod...
2017-10-10 17:32:00 80
转载 257. Binary Tree Paths
Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree: 1 / \2 3 \ 5All root-to-leaf paths are:["1->2->5", "1->3...
2017-09-28 14:27:00 76
转载 226. Invert Binary Tree
Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1Trivia:This problem was inspired bythis original tweetbyM...
2017-09-26 11:41:00 69
转载 111. Minimum Depth of Binary Tree
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. 1 /** 2 * Definition for a ...
2017-09-24 08:42:00 70
转载 101. Symmetric Tree
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree[1,2,2,3,4,4,3]is symmetric: 1 / \ 2 2 / \ / \3 4...
2017-09-23 09:12:00 90
转载 Combination Sum
39、combination sum1Given asetof candidate numbers (C)(without duplicates)and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Thesamerepeated...
2017-09-15 17:08:00 62
转载 百度之星2017 资格赛1003
#include <cstdio>#include <cstring>#include <cmath>#include <map>#include <set>#include <iostream>#include <algorithm>#include <string>using namesp...
2017-08-09 21:12:00 76
转载 112. Path Sum 113. Path Sum II
回溯法的典型1、Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example:Given the below binary ...
2017-08-09 10:48:00 74
转载 104. Maximum Depth of Binary Tree
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node./** * Definition for a b...
2017-08-08 19:04:00 80
转载 515. Find Largest Value in Each Tree Row
You need to find the largest value in each row of a binary tree.Example:Input: 1 / \ 3 2 / \ \ 5 3 9 Output: [1, 3, 9]/*...
2017-08-02 16:14:00 75
转载 Leetcode 623. Add One Row to Tree
Given the root of a binary tree, then valuevand depthd, you need to add a row of nodes with valuevat the given depthd. The root node is at depth 1.The adding rule is: given a positive int...
2017-08-01 17:32:00 100
转载 Leetcode 637. Average of Levels in Binary Tree
Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array.Example 1:Input: 3 / \ 9 20 / \ 15 7Output: [3, 14.5, 11]...
2017-08-01 11:33:00 57
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人