1. 问题描述 给定一个整数数组nums[],查找是否存在两个下标i和j,满足|numsi?numsj|≤t|nums_i-nums_j| \le t 且 |i?j|≤k|i-j| \le k。2. 方法与思路 总得思路就是:“滑动窗口”+unordered_map。
推理过程如下:
|numsi?numsj|≤t?|numsi/t?numsj/t|≤1|nums_i-nums_j|...
分类:
其他好文 时间:
2015-06-24 22:41:57
阅读次数:
328
Find the total area covered by two rectilinear rectangles in a 2D plane.
Each rectangle is defined by its bottom left corner and top right corner as shown in the figure.
Assume that the tota...
分类:
其他好文 时间:
2015-06-24 22:41:14
阅读次数:
119
Related to question
Excel Sheet Column Title
Given a column title as appear in an Excel sheet, return its corresponding column number.
For example:
A -> 1
B -> 2
C -> 3
...
Z ...
分类:
其他好文 时间:
2015-06-24 22:40:14
阅读次数:
150
四五月份做ACM校赛都是没怎么接触过评测系统,很多注意要点都不了解。网络赛给时间长,最后全AC通过了,现场赛虽然一等奖,但是还是有点捉襟见肘,7道题目只做出来了4道,因为会的这几道代码提交比较早,所以才能得到一等奖,但是问题也还是比较明显,对于很多学过的数据结构和算法的知识运用不熟练,快速编程实现能力还是比较弱。所以6月份觉得自己需要大量的训练,所以从6号开始,到今天已经18天了,18天100道题目,也是努力坚持一步一步走过来,虽然100道题目不多,UVa hunting上第一名大神AC了4527道。。。感...
分类:
其他好文 时间:
2015-06-24 22:38:32
阅读次数:
198
在web应用中,有时候客户需要一些定时程序,不需要客户自己去操作,而是由应用程序自行触发(代理)执行某些操作。这个时候监听与定时器的配合使用就基本可以实现这个需求了。网上很多代码并不完整,水平未到,看得太吃力了.下面以系统每天00:00:00进行的当日最大单据数维护进行实例解析。...
分类:
其他好文 时间:
2015-06-24 22:39:04
阅读次数:
256
#104 Maximum Depth of Binary Tree
Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node...
分类:
其他好文 时间:
2015-06-24 22:38:28
阅读次数:
164
Problem A: 求第K大数
Time Limit: 2 Sec Memory Limit: 128 MB
Submit: 81 Solved: 32
[Submit][Status][Web
Board] [Edit] [TestData]
Description
一天,喜欢看电影的DoubleQ 和 XXZ 来到一个神奇的电影院,这个电影院可以同时放映n部电影...
分类:
其他好文 时间:
2015-06-24 22:40:11
阅读次数:
153
小项目:智能家居家电控制面板
时间:2015年4月23号~2015年6月24号,为期两个月
总结:是否认真?0.5
是否具有挑战性?0.1
是否学习到了方法?0.5
是否还可以做得更好?1.0...
分类:
其他好文 时间:
2015-06-24 22:37:39
阅读次数:
119
一.简单工厂类
二。工厂方法模式实现
三、简单工厂和工厂方法
简单工厂模式的最大优点在于工厂类中包含了必要的逻辑判断,根据客户端的选择条件动态实例化相关的类,对于客户端来说,去除了与具体产品的依赖。
@工厂方法模式(factory method):定义一个用于创建对象的接口,让子类决定实例化哪一个类。工厂...
分类:
其他好文 时间:
2015-06-24 22:37:24
阅读次数:
188
#include
using namespace std;class ProductAbase
{
public:
ProductAbase(){}
virtual ~ProductAbase(){}
virtual void Printf() = 0;
};
class Product1 : public ProductAbase
{
public:...
分类:
其他好文 时间:
2015-06-24 22:36:35
阅读次数:
117
Using Redis as an LRU cache使用Redis作为LRU缓存
出处:http://blog.csdn.net/column/details/redisbanli.html
When Redis is used as a cache, sometimes it is handy to let it automatically evict old ...
分类:
其他好文 时间:
2015-06-24 22:37:25
阅读次数:
209
对于常见的C++程序,像缺省_cdecl或使用_stdcall的函数压栈顺序都是采用的从右往左压栈的。(_pascall使用的从左往右压栈。)...
分类:
其他好文 时间:
2015-06-24 22:37:43
阅读次数:
195
适用环境:powerbuilder 10.0以后的版本 window server2003以后的测试可用
PB也可以调用系统自带的DLL 实现MD5
//调用样例:
u_derek_md5 lu_md5
lu_md5=create u_derek_md5
string ls_text="123"
string ls_result,ls_ret
string ls_filep...
分类:
其他好文 时间:
2015-06-24 22:35:24
阅读次数:
725
sendto
recvfrom...
分类:
其他好文 时间:
2015-06-24 22:35:53
阅读次数:
176
Cookie实际上是一小段的文本信息。客户端请求服务器,如果服务器需要记录该用户状态,就使用response向客户端浏览器颁发一个Cookie。客户端浏览器会把Cookie保存起来。当浏览器再请求该网站时,浏览器把请求的网址连同该Cookie一同提交给服务器。服务器检查该Cookie,以此来辨认用户状态。服务器还可以根据需要修改Cookie的内容。...
分类:
其他好文 时间:
2015-06-24 22:36:10
阅读次数:
204
第一~第四章:1、是不是一定要程序理解,程序理解中说新成员要尽快读懂已有的程序,了解程序的设计,那么如果已有的程序很庞大,很复杂,不懂其编程思想,新成员要读懂它不是要花很多时间吗?还要花精力去学习新的,这样不是要浪费时间与精力吗?(第一章 P4)答:若是团队中有新增加了新成员,对于已有的程序,要想减...
分类:
其他好文 时间:
2015-06-24 22:32:59
阅读次数:
134
deque supports const time insert and erase operations at the beginning or the end, insert or erase in the middle take linear time.vector在中间位置插入和删除操作时间...
分类:
其他好文 时间:
2015-06-24 22:33:56
阅读次数:
201