- 博客(15)
- 收藏
- 关注
原创 JavaScript中apply()与call()的区别
apply()与call()的应用充分体现了JavaScript的动态变换运行时上下文特征,call,apply两个方法的示例如下:foo.call(this,arg1,arg2,arg3)==foo.apply(this,arguments)==this.foo(arg1,arg2,arg3)参数:this是方法执行时上下文相关对象,arg1,arg2,arg3是传给foo方法的参数。所谓的方法
2016-05-30 10:32:39 267
原创 express-session(express4.0与express 3.0的区别)
express-session deprecated undefined resave option; provide resave option app.js:16:9express-session deprecated undefined saveUninitialized option; provide saveUninitialized option app.js:16:9解决方
2016-05-23 20:09:59 896
原创 Bulb Switcher
There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle every third bulb (turning on if it's off or turning of
2016-05-22 21:43:04 217
原创 Power of Two
Given an integer, write a function to determine if it is a power of two.JAVA代码实现:思路一:求一个数是否为2的幂,可以通过n^(log2(n))求得,但是JAVA库函数Math.log()是以自然对数e为底的,这就需要利用数学公式,将其转换为以2为底的;再利用JAVA库函数Math.pow();求得n^(log2
2016-05-22 20:28:09 208
原创 AJAX中GET与POST的区别
GET&POST:GET:(1)适合幂等的请求(所谓幂等是指多个请求返回相同的结果);(2)将数据追加到URL发送,浏览器和服务器会限制URL的长度,所以GET请求发送的数据量较小;(3)GET请求。POST:(1)改变服务器上的状态时应当用POST方法;(2)需要设置XML-HttpRequest对象的Content-Type首部,例如:xmlHttp.set
2016-05-20 10:30:49 1848 1
原创 LeenCode
Remove Linked List ElementsRemove all elements from a linked list of integers that have value val.ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 --
2016-05-20 09:21:32 433 2
原创 LeenCode--Reverse Linked List
Reverse Linked List思路一:首先看是否含有头结点(newHead),若无头节点,创建头节点记录其第一个节点位置,头结点后的第一个初始节点记录为current,将current.next不断调换至newHead.next;JAVA实现:public class Solution { public ListNode reverseList(ListNod
2016-05-19 21:51:16 289
原创 LeenCode--Remove Element
题目:Given an array and a value, remove all instances of that value in place and return the new length.Do not allocate extra space for another array, you must do this in place with constant me
2016-05-19 18:00:15 212
原创 Pascal's Triangle II
注:转载请注明出处Pascal's Triangle II题目:Given an index k, return the kth row of the Pascal's triangle.For example, given k = 3,Return [1,3,3,1].Java:
2016-05-17 14:40:47 268
原创 Pascal's Triangle
注:转载请注明出处!!!Pascal's Triangle题意:Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,
2016-05-17 14:29:23 221
原创 Java中int integer 区别以及相互转换
int与integer的区别从大的方面来说就是基本数据类型与其包装类的区别:int 是基本类型,直接存数值,而integer是对象,用一个引用指向这个对象1.类型不同:Java 中的数据类型分为基本数据类型和复杂数据类型int 是前者而integer 是后者(也就是一个类);因此在类进行初始化时int类的变量初始为0.而Integer的变量则初始化为null.
2016-05-17 14:24:59 5098
原创 Move Zeroes ——LeenCode
Java实现Move Zeroes ,题目如下:时间复杂度(N^2):解题思想首先遍历数组,若数组中存在0,记录0的个数的变量count自加一,且0以后的数据依次上移一位,数组长度减1;遍历数组后,根据记录的0的个数,依次从数组末尾赋值0;public class Solution { public void moveZeroes(int[] nums) {
2016-05-17 10:15:58 340
原创 React入门教程(二)
React基础总结(续)示例代码:CommentBox=React.createClass({displayName:'CommentBox', render:function(){ return( React.createElement('div',{className:"commentBox"}, "Hello,
2016-05-16 16:09:23 384
原创 React入门教程(一)——JSX学习篇
为什么要使用React?——构建随着时间数据不断变化的大规模应用程序开始学习主要思想:1.仅仅只要表达出你的应用程序在任一时间点应该长的样子,然后当底层的数据变了,Recat会自动处理所有用户界面的更新。类似于,用户点击刷新按钮,只更新变化的部分。2.构建可用组件:通过 React 你唯一要做的事情就是构建组件。得益于其良好的封装性,组件使代码复用、测试和关注分离(sepa
2016-05-16 11:24:15 1479
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人