码迷,mamicode.com
首页 >  
搜索关键字:binary trees    ( 12390个结果)
[leetcode 221]Maximal Square
Maximal Square Total Accepted: 8699 Total Submissions: 44034 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,...
分类:其他好文   时间:2015-08-03 17:00:01    阅读次数:115
Leetcode-107(Java) Binary Tree Level Order Traversal II
Given a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For exa...
分类:编程语言   时间:2015-08-03 16:44:18    阅读次数:162
Leetcode-102(Java) Binary Tree Level Order Traversal
Given a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree{3,9,2...
分类:编程语言   时间:2015-08-03 16:19:17    阅读次数:143
hdu5200 Trees(逆向思维+离线处理)
题意描述: 在一条直线上有n棵树,每棵树有一个高度。现在进行查询:给一个高度h,把小于等于h的树砍掉,剩余的树能组成几个块? 块的定义:一个块要包含尽可能多的位置连续的树,而且被包含的树没有被砍掉 解题思路:离线处理 1、逆向思维:砍树的对立面就是长树                 (1)如果我们把树的高度和查询高度都按从大到小的顺序排序,初始化直线上没有一棵树存在;    ...
分类:其他好文   时间:2015-08-03 14:54:51    阅读次数:70
[LeetCode]230.Kth Smallest Element in a BST
题目Given a binary search tree, write a function kthSmallest to find the kth smallest element in it.Note: You may assume k is always valid, 1 ≤ k ≤ BST’s total elements.Follow up: What if the BST is m...
分类:其他好文   时间:2015-08-03 14:50:03    阅读次数:112
Binary Search Tree Iterator ***
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 next...
分类:其他好文   时间:2015-08-03 13:01:20    阅读次数:116
Lowest Common Ancestor of a Binary Search Tree
Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to thedefinition of LCA on Wikipedia: ...
分类:其他好文   时间:2015-08-03 10:06:50    阅读次数:119
一道算法题目, 二行代码, Binary Tree
June 8, 2015我最喜欢的一道算法题目, 二行代码.编程序需要很强的逻辑思维, 多问几个为什么, 可不可以简化.想一想, 二行代码, 五分钟就可以搞定; 2015年网上大家热议的 Homebrew 的作者Max Howell面试Google 挂掉的一题, 二叉树反转, 七行代码, 相比二行代...
分类:编程语言   时间:2015-08-03 06:33:40    阅读次数:142
Lowest Common Ancestor****
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to thedefinition of LCA on Wikipedia: “The lowest ...
分类:其他好文   时间:2015-08-03 01:10:46    阅读次数:121
Binary Tree Right Side View
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 exampl...
分类:其他好文   时间:2015-08-03 01:04:34    阅读次数:104
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!