上次的湘潭赛的C题,用线段树敲了下还是WA,不知道为何,我已经注意了处理相同数据,然后他们当时用的RMQ。所以学了下RMQ,感觉算法思想是一样的,RMQ用了DP或者是递推,由单个数到2^k往上推,虽然有部分重叠的,也没关系,因为RMQ是求区间最值嘛然后这道题目,要把出现次数化为最值,构造一个新的数组...
分类:
其他好文 时间:
2014-06-16 06:21:13
阅读次数:
248
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
题目
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
题目
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
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string;
{
NSString * toBeString = [textField.text stringByReplacingCharacter...
分类:
其他好文 时间:
2014-06-15 15:39:11
阅读次数:
162
关于tarjan的思想可以在网上搜到,具体我也不太清楚,应该说自己理解也不深,下面是做题经验得到的一些模板。其中有很多转载,包括BYVoid等,感谢让我转。。。望各路大神愿谅有向图求连通分量的一般方法:
1 void Tarjan(u) { 2 dfn[u]=low[u]=++index 3...
分类:
其他好文 时间:
2014-06-13 16:14:11
阅读次数:
395
NSMutableAttributedString*str=[[NSMutableAttributedStringalloc]initWithString:@"UsingNSAttributedString"];[straddAttribute:NSForegroundColorAttributeNamevalue:[UIColorblueColor]range:NSMakeRange(0,5)];[straddAttribute:NSForegroundColorAttributeNamevalue:[UI..
分类:
其他好文 时间:
2014-06-10 22:32:09
阅读次数:
291
原题地址: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
百度了一下vlookup的语法规则:
该函数的语法规则如下:
VLOOKUP(lookup_value,table_array,col_index_num,range_lookup)
参数
简单说明
输入数据类型
lookup_value
要查找的值
数值、引用或文本字符串
...
分类:
其他好文 时间:
2014-06-10 18:13:53
阅读次数:
253
原题地址: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