码迷,mamicode.com
首页 >  
搜索关键字:lintcode    ( 1584个结果
[LintCode] Insert Node in a Binary Search Tree
Given a binary search tree and a new tree node, insert the node into the tree. You should keep the tree still be a valid binary search tree. You can a ...
分类:其他好文   时间:2017-07-14 13:32:18    阅读次数:139
Lintcode---单词的添加与查找
设计一个包含下面两个操作的数据结构:addWord(word), search(word) addWord(word)会在数据结构中添加一个单词。而search(word)则支持普通的单词查询或是只包含.和a-z的简易正则表达式的查询。 一个 . 可以代表一个任何的字母。 注意事项 你可以假设所有的 ...
分类:其他好文   时间:2017-07-08 11:14:23    阅读次数:236
Lintcode---区间最小数
给定一个整数数组(下标由 0 到 n-1,其中 n 表示数组的规模),以及一个查询列表。每一个查询列表有两个整数 [start, end]。 对于每个查询,计算出数组中从下标 start 到 end 之间的数的最小值,并返回在结果列表中。 注意事项 在做此题前,建议先完成以下三道题 线段树的构造,  ...
分类:其他好文   时间:2017-07-05 22:58:20    阅读次数:347
50、树中两个节点的公共祖先
详细的询问: 1、该树是二叉查找树? 最近公共祖先 二叉查找树:(http://www.lintcode.com/problem/lowest-common-ancestor/) 思路:利用左子树特点:左子树 < 根 <= 右,输入节点跟根节点比较,都小于,在左子树,都大约右子树,递归的去遍历;找到 ...
分类:其他好文   时间:2017-07-03 23:45:50    阅读次数:322
Lintcode---二叉树的序列化和反序列化
设计一个算法,并编写代码来序列化和反序列化二叉树。将树写入一个文件被称为“序列化”,读取文件后重建同样的二叉树被称为“反序列化”。 如何反序列化或序列化二叉树是没有限制的,你只需要确保可以将二叉树序列化为一个字符串,并且可以将字符串反序列化为原来的树结构。 注意事项 There is no limi ...
分类:其他好文   时间:2017-07-03 15:04:15    阅读次数:230
[LintCode] Validate Binary Search Tree
Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only ...
分类:其他好文   时间:2017-07-01 01:00:31    阅读次数:275
Lintcode42 Maximum Subarray II solution 题解
【题目描述】Givenanarrayofintegers,findtwonon-overlappingsubarrayswhichhavethelargestsum.Thenumberineachsubarrayshouldbecontiguous.Returnthelargestsum.Notice:Thesubarrayshouldcontainatleastonenumber给定一个整数数组,找出两个不重叠子数组使得它们的和最大。每..
分类:其他好文   时间:2017-06-29 00:58:48    阅读次数:134
从一道例题谈Arrays.toString()与其他String的转换方法
阅读该篇文章前,请大家事先阅读一下: java.toString(),(String),String.valueOf的区别 有了上述基础后,我接下来谈谈从一道题目中获得的些许收获。 今天在做题是发现了非常重要的一点。题目来源:http://www.lintcode.com/en/problem/an ...
分类:其他好文   时间:2017-06-26 18:02:24    阅读次数:192
LinCode 刷题 之二叉树最小深度
http://www.lintcode.com/zh-cn/problem/minimum-depth-of-binary-tree/ 题目描述信息 二叉树的结构定义如下: /** * Definition of TreeNode: * public class TreeNode { * publi ...
分类:其他好文   时间:2017-06-26 13:38:25    阅读次数:139
Lintcode40 Implement Queue by Two Stacks solution 题解
【题目描述】Asthetitledescribed,youshouldonlyusetwostackstoimplementaqueue‘sactions.Thequeueshouldsupportpush(element),pop()andtop()wherepopispopthefirst(a.k.afront)elementinthequeue.Bothpopandtopmethodsshouldreturnthevalueoffirstelement.正如标题所述,你需..
分类:其他好文   时间:2017-06-26 10:26:39    阅读次数:113
1584条   上一页 1 ... 43 44 45 46 47 ... 159 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!