Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complet...
分类:
其他好文 时间:
2014-11-25 14:02:10
阅读次数:
175
leetcode Min StackDesign a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stac...
分类:
其他好文 时间:
2014-11-25 12:31:30
阅读次数:
129
SAX工作原理:当扫描到文档(document)开始与结束、元素(element)开始与结束、文档(document)结束等地方时同志时间处理函数,由时间处理函数做相应动作,然后继续同样的扫描,直至文档结束。从网络上下载XML代码进行处理读取网络文件内容的方法参考http://shamrock.blog.5..
分类:
移动开发 时间:
2014-11-24 22:44:22
阅读次数:
222
这篇会很短。 那么如上图所示,margin指的是外边距,padding指的是内边距,border自有其像素宽度,element在1335乘以392的地方。 margin和padding一样总共有四个,上右下左——top right bottom left。你可以选择margin-top这...
分类:
其他好文 时间:
2014-11-24 22:07:40
阅读次数:
236
给定一个矩阵,如果有零元素那么就将零元素所在的行和列都置为零。
Given a m x n matrix,
if an element is 0, set its entire row and column to 0. Do it in place.
最直观的解法就是开辟一个新的矩阵,当原矩阵存在零元素的时候,就将新矩阵的对应行和列置为零。这样空间复杂度较高,也是题目不允许的。
题目的难...
分类:
编程语言 时间:
2014-11-24 20:53:43
阅读次数:
314
问题描述:
Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
Your...
分类:
其他好文 时间:
2014-11-24 20:51:50
阅读次数:
171
此文章修改自http://yanhaijing.com/jquery/2013/12/05/writing-better-jquery-code/,截取了其中认为很有用的部分。1.缓存变量,DOM遍历是昂贵的,所以尽量将会重用的元素缓存。// 糟糕h = $('#element').height()...
分类:
Web程序 时间:
2014-11-24 20:44:55
阅读次数:
184
HTML 5中的full screen,目前可以在除IE和opera外的浏览器中使用 ,有的时候用来做全屏API,游戏呀,等都很有用。先看常见的API1 element.requestFullScreen() 作用:请求某个元素element全屏2Document.getElementById(“m...
分类:
编程语言 时间:
2014-11-24 18:32:04
阅读次数:
174
1.事件流; 捕获(ie部分不支持); 冒泡(有些事件不支持冒泡 => 例: focus); 2.事件处理;事件监听器; element.on{EventName}; element.addEventListener / element.removeEventListener...
分类:
其他好文 时间:
2014-11-24 16:35:54
阅读次数:
209
function addClass1(element,value){ if(!element.className){ element.className = value; }else{ newClassName = elem...
分类:
其他好文 时间:
2014-11-24 11:38:46
阅读次数:
137