https://oj.leetcode.com/problems/min-stack/http://blog.csdn.net/linhuanmars/article/details/41008731classMinStack{
publicvoidpush(intx){
data.push(x);
if(min.empty()||(x<=(int)min.peek()))
{
min.push(x);
}
}
publicvoidpop(){
if(data.empty())
return;
in..
分类:
其他 时间:
2015-01-09 19:32:46
收藏:
0 评论:
0 赞:
0 阅读:
185
***************************************************Remote验证概要:如果要实现像用户注册那样,不允许出现重复的账户,就可以用到Remote验证。Remote特性允许利用服务器端的回调函数执行客户端的验证逻辑。它只是在文本框中输入字符的时候向服务器提交get请求,Remote验证..
分类:
Web开发 时间:
2015-01-09 19:32:27
收藏:
0 评论:
0 赞:
0 阅读:
362
在ruby中我们要实现遍历指定目录的方法,网上的方法也非常之多,我们可以拿来参考参考,如下边的traverse.rb文件内容所示:#!/usr/bin/ruby
deftraverse(filepath)
ifFile.directory?(filepath)
puts"Dirs:"+filepath
Dir.foreach(filepath)do|filename|
iffilename!="."andfil..
分类:
其他 时间:
2015-01-09 19:32:17
收藏:
0 评论:
0 赞:
0 阅读:
305
https://oj.leetcode.com/problemset/algorithms/http://www.cnblogs.com/yuzhangcmu/p/4128794.html/**
*Definitionforsingly-linkedlist.
*publicclassListNode{
*intval;
*ListNodenext;
*ListNode(intx){
*val=x;
*next=null;
*}
*}
*/
publicclassSolution{
//Assumehead..
分类:
其他 时间:
2015-01-09 19:32:07
收藏:
0 评论:
0 赞:
0 阅读:
253
在linux系统中,许多元字符,如分号(semicolon),空格(space),反斜线(backslash),美元符号(dollarsigh),问号(questionmark),星号(asterisk)通常被解释为命令,-(dashes)或者--被解释为命令的选项,通过以下的方式就可以复制、移动、删除带-或者--的文件,:1、首先,创建..
分类:
移动平台 时间:
2015-01-09 19:31:37
收藏:
0 评论:
0 赞:
0 阅读:
305
MHA多VIP多MySQL实例的支持首先看power_manager脚本MHAManager如果能够SSH到Master主机,会调用stopssh方法,stopssh方法根据master_pid_file来远程killMySQL实例的进程,不管是kill成功还是失败,最后都要返回10,至于kill掉所有mysqlinstance的代码直接去掉。MHAManager如果..
分类:
数据库技术 时间:
2015-01-09 19:31:27
收藏:
0 评论:
0 赞:
0 阅读:
540
SysRq:HELP:loglevel(0-9)reBootCrashterminate-all-tasks(E)memory-full-oom-kill(F)kill-all-tasks(I)thaw-filesystems(J)saKshow-memory-usage(M)nice-all-RT-tasks(N)powerOffshow-registers(P)show-all-timers(Q)unRawSyncshow-task-states(T)Unmountshow-blocked-tasks(W..
分类:
系统服务 时间:
2015-01-09 19:31:18
收藏:
0 评论:
0 赞:
0 阅读:
1609
计划任务分2种:1、例外性:按一定的周期循环来执行工作,例如每月发薪水、每天一次的工作报告、每天需要的打卡等等;2、临时性:指定时间执行的命令,这次做完下次不必做的,例如女朋友的生日、领导检查工作等;这些计划任务的工作Linux也都可以帮助我们,例如:每天早6:00要..
分类:
其他 时间:
2015-01-09 19:31:07
收藏:
0 评论:
0 赞:
0 阅读:
349
在搭建好PHP环境之后,在配置完phpmyadmin登录时(可以用http://localhost/phpmyadmin,也可以为phpmyadmin设置一个独立的虚拟主机),提示cannotstartsessionwithouterrors,pleasecheckerrorsgiveninyourPHPand/orwebserverlogfileandconfigureyourPHPinstallationproperly.这..
分类:
Web开发 时间:
2015-01-09 19:30:47
收藏:
0 评论:
0 赞:
0 阅读:
366
https://oj.leetcode.com/problemset/algorithms/http://siddontang.gitbooks.io/leetcode-solution/content/array/find_peak_element.htmlpublicclassSolution{
publicintfindPeakElement(int[]num){
//SolutionA:
returnfindPeakElement_Binary(num);
//SolutionB:
//retur..
分类:
其他 时间:
2015-01-09 19:30:36
收藏:
0 评论:
0 赞:
0 阅读:
189
https://oj.leetcode.com/problems/compare-version-numbers/http://blog.csdn.net/u012243115/article/details/41969181publicclassSolution{
publicintcompareVersion(Stringversion1,Stringversion2){
if(version1==null||version2==null)
return0;//Invalidinput.
//NOTE!..
分类:
其他 时间:
2015-01-09 19:30:16
收藏:
0 评论:
0 赞:
0 阅读:
260
https://oj.leetcode.com/problems/excel-sheet-column-title/http://blog.csdn.net/miss_snow_m/article/details/42098357publicclassSolution{
publicStringconvertToTitle(intn){
if(n<=0)
returnnull;
StringBuildersb=newStringBuilder();
do
{
intd=n%26;
sb.append..
分类:
其他 时间:
2015-01-09 19:30:06
收藏:
0 评论:
0 赞:
0 阅读:
235
操作系统升级到centos7后默认的FS变成了xfs首先找个现成的分区练练手[root@localhostothers]#df-hTFilesystemTypeSizeUsedAvailUse%Mountedon/dev/mapper/centos-rootxfs28G5.9G22G22%/devtmpfsdevtmpfs912M0912M0%/devtmpfstmpfs920M0920M0%/dev/shmtmpfstmpfs920M8.7M912M1%/..
分类:
其他 时间:
2015-01-09 19:29:57
收藏:
0 评论:
0 赞:
0 阅读:
1103
<filter><filter-name>struts-cleanup</filter-name><filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class></filter><filter-mapping><filter-name>struts-cleanup</filter-name><url-p..
分类:
其他 时间:
2015-01-09 19:29:47
收藏:
0 评论:
0 赞:
0 阅读:
281
https://oj.leetcode.com/problems/majority-element/publicclassSolution{
publicintmajorityElement(int[]num){
intlen=num.length;
intminhit=(len/2)+1;
Map<Integer,Integer>map=newHashMap<>();
for(inti:num)
{
Integeroccur=map.get(i);
if(occur==null)
..
分类:
其他 时间:
2015-01-09 19:29:36
收藏:
0 评论:
0 赞:
0 阅读:
259
https://oj.leetcode.com/problems/excel-sheet-column-number/publicclassSolution{
publicinttitleToNumber(Strings){
if(s==null||s.isEmpty())
return0;//invalidinput
char[]chars=s.toCharArray();
intr=0;
for(charc:chars)
{
r=r*26+(c-‘A‘)+1;
}
returnr;
}
}
分类:
其他 时间:
2015-01-09 19:29:26
收藏:
0 评论:
0 赞:
0 阅读:
253
迭代器和生成器是python学者们经常谈到的话题,我也不能免俗,因为实在值得总结一下。迭代器迭代器是对可迭代对象进行操作,通过next方法一次吐出一个元素的工具。我们用到的for..in..内部使用的就是迭代器功能。如果要自定义一个迭代器类的话,需要满足下面的条件:需要在类中..
分类:
编程语言 时间:
2015-01-09 19:29:17
收藏:
0 评论:
0 赞:
0 阅读:
321
在项目根目录建议一个.gitignore文件,根据需要输入如下内容(可参见官方模板https://github.com/github/gitignore)#-------Object-c----#Xcode#build/*.pbxuser!default.pbxuser*.mode1v3!default.mode1v3*.mode2v3!default.mode2v3*.perspectivev3!default.perspectivev3xcu..
分类:
其他 时间:
2015-01-09 19:29:06
收藏:
0 评论:
0 赞:
0 阅读:
284
https://oj.leetcode.com/problems/factorial-trailing-zeroes/publicclassSolution{
publicinttrailingZeroes(intn){
if(n<=0)
return0;//Invalidinput.
//Howmany5s,25s,125s...
intbase=5;
intfives=0;
do
{
fives+=n/d;
base*=5;
}
while(base<=n);
returnfives;
}
}
分类:
其他 时间:
2015-01-09 19:28:56
收藏:
0 评论:
0 赞:
0 阅读:
172
packagecom.ctgu.java.exer;
publicclassTestArray{
publicstaticvoidmain(String[]args){
int[]array1,array2;
array1=newint[]{2,3,5,7,11,13,17,19};
for(inti=0;i<array1.length;i++){
System.out.print(array1[i]+"\t");
}
System.out.println();..
分类:
编程语言 时间:
2015-01-09 19:28:36
收藏:
0 评论:
0 赞:
0 阅读:
279