码迷,mamicode.com
首页 >  
搜索关键字:binary trees    ( 12390个结果)
124 Binary Tree Maximum Path Sum
题目:124 Binary Tree Maximum Path Sum这道题就是分别算出左子树和右子树的可能最大和,然后对Path的值进行更新即可class Solution: def __init__(self): self.ans = -100000 def maxPa...
分类:其他好文   时间:2015-07-15 14:40:29    阅读次数:96
【leetcode】67. Add Binary
leetcode add binary 模拟大数相加 时间复杂度: O(n) 空间复杂度: O(n)...
分类:其他好文   时间:2015-07-15 13:20:57    阅读次数:120
Maximal Square
问题描述Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area.For example, given the following ...
分类:其他好文   时间:2015-07-15 12:33:46    阅读次数:92
Codeforces Round #312 (Div. 2) A Lala Land and Apple Trees
题目链接:A. Lala Land and Apple Trees 题面: A. Lala Land and Apple Trees time limit per test 1 second memory limit per test 256 megabytes input standard input output standard...
分类:移动开发   时间:2015-07-15 11:07:59    阅读次数:473
Symmetric Tree
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 / \ ...
分类:其他好文   时间:2015-07-15 10:42:31    阅读次数:111
Codeforces 558A Lala Land and Apple Trees 摘苹果
题意:n棵苹果树在x轴上排成一排,每棵苹果树有一个坐标值(均不为0)和苹果数量。现在某人从0开始任意选择一个方向走,每遇到一颗新的苹果树就摘下所有苹果,然后掉转方向直到遇到下一颗之前没遇到过的苹果树然后再摘下所有苹果,如此往复直到再也遇不到新的苹果树。问最多能摘下多少个苹果。 水题。以0为中心,对坐标排序后计算左右两边的苹果树个数。如果左边小于右边,就先从左边摘,...
分类:移动开发   时间:2015-07-15 09:32:54    阅读次数:149
Codeforces Round #312 (Div. 2)
A. Lala Land and Apple Trees题目描述: 一条坐标轴,在坐标轴上散布了一些苹果树,每棵树都有位置和所结果实数目两个属性,Amr在坐标轴0点的位置,Amr在开始的时候可以选择向左或者右走,然后遇到果树才能改变方向,问最后最多能拿到多少个苹果?解题思路: 开两个数组,分别代.....
分类:其他好文   时间:2015-07-15 09:16:11    阅读次数:122
【Binary Search Tree Iterator 】cpp
题目:Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Callingnext()will return the n...
分类:其他好文   时间:2015-07-14 20:26:17    阅读次数:118
【Binary Tree Right Side View 】cpp
题目:Given a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you can see ordered from top to bottom.For exa...
分类:其他好文   时间:2015-07-14 20:17:02    阅读次数:127
【Count Complete Tree Nodes】cpp
题目:Given acompletebinary tree, count the number of nodes.Definition of a complete binary tree fromWikipedia:In a complete binary tree every level, exc...
分类:其他好文   时间:2015-07-14 19:46:38    阅读次数:85
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!