码迷,mamicode.com
首页 >  
搜索关键字:rmq range minimummax    ( 10438个结果
UVA 11235 RMQ算法
上次的湘潭赛的C题,用线段树敲了下还是WA,不知道为何,我已经注意了处理相同数据,然后他们当时用的RMQ。所以学了下RMQ,感觉算法思想是一样的,RMQ用了DP或者是递推,由单个数到2^k往上推,虽然有部分重叠的,也没关系,因为RMQ是求区间最值嘛然后这道题目,要把出现次数化为最值,构造一个新的数组...
分类:其他好文   时间:2014-06-16 06:21:13    阅读次数:248
Range-Based for Loops
for ( decl : coll ){ statement}where decl is the declaration of each element of the passed collection coll and for which the statements specified are....
分类:其他好文   时间:2014-06-15 22:11:18    阅读次数:295
Search for a Range
题目 Given a sorted array of integers, find the starting and ending position of a given target value. Your algorithm's runtime complexity must be in the order of O(log n). If the target i...
分类:其他好文   时间:2014-06-15 16:53:32    阅读次数:177
[LeetCode] Search for a Range [34]
题目 Given a sorted array of integers, find the starting and ending position of a given target value. 解题思路: 查找一个数出现的范围,给一个排好序的数组和一个数,找出这个数在数组中出现的范围。 这个题直接使用一次遍历就可以得到结果,这样的时间复杂度为O(n)。但是对于有序数组我们一般可以使用二分查找可以得到更好的O(logn)的时间复杂度。我们可以使用二分查找找到这个数第一次出现的位置和这个数最后一次出现的位...
分类:其他好文   时间:2014-06-15 16:19:16    阅读次数:237
UItexfile实时验证输入字符
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string; {     NSString * toBeString = [textField.text stringByReplacingCharacter...
分类:其他好文   时间:2014-06-15 15:39:11    阅读次数:162
Tarjan算法各种&RMQ& POJ 3694
关于tarjan的思想可以在网上搜到,具体我也不太清楚,应该说自己理解也不深,下面是做题经验得到的一些模板。其中有很多转载,包括BYVoid等,感谢让我转。。。望各路大神愿谅有向图求连通分量的一般方法: 1 void Tarjan(u) { 2 dfn[u]=low[u]=++index 3...
分类:其他好文   时间:2014-06-13 16:14:11    阅读次数:395
UILabel 多颜色、字体
NSMutableAttributedString*str=[[NSMutableAttributedStringalloc]initWithString:@"UsingNSAttributedString"];[straddAttribute:NSForegroundColorAttributeNamevalue:[UIColorblueColor]range:NSMakeRange(0,5)];[straddAttribute:NSForegroundColorAttributeNamevalue:[UI..
分类:其他好文   时间:2014-06-10 22:32:09    阅读次数:291
[leetcode]Roman to Integer @ Python
原题地址:https://oj.leetcode.com/problems/roman-to-integer/题意:Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range f...
分类:编程语言   时间:2014-06-10 19:34:10    阅读次数:255
excle查找操作-vlookup的使用心得
百度了一下vlookup的语法规则: 该函数的语法规则如下: VLOOKUP(lookup_value,table_array,col_index_num,range_lookup) 参数 简单说明 输入数据类型 lookup_value 要查找的值 数值、引用或文本字符串 ...
分类:其他好文   时间:2014-06-10 18:13:53    阅读次数:253
[leetcode]Integer to Roman @ Python
原题地址:https://oj.leetcode.com/problems/integer-to-roman/题意:Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range f...
分类:编程语言   时间:2014-06-10 17:06:11    阅读次数:261
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!