“我们创建的每一个函数都有一个prototype(原型)属性,这个属性是一个指针,指向一个对象,而这个对象的用途是包含可以由特定类型的所有实例共享的属性和方法。” 引用类型才具有prototype属性,包含: 1.Object 2.Function 3.Array 4.Date 5.String 6 ...
分类:
编程语言 时间:
2016-08-07 18:25:30
阅读次数:
257
Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements ...
分类:
其他好文 时间:
2016-08-07 16:47:25
阅读次数:
125
知识点: 1)数组 数组是用来存储一系列值的变量,可通过索引来访问数组的值。 Awk中数组称为关联数组,因为它的下标(索引)可以是数字也可以是字符串。 下标通常称为键,数组元素的键和值存储在Awk程序内部的一个表中,该表采用散列算法,因此数组元素是随机排序。 数组格式:array[index]=va ...
分类:
其他好文 时间:
2016-08-07 15:23:33
阅读次数:
210
Given an unsorted array nums, reorder it in-place such that nums[0] <= nums[1] >= nums[2] <= nums[3].... For example, given nums = [3, 5, 2, 1, 6, 4], ...
分类:
其他好文 时间:
2016-08-07 15:16:24
阅读次数:
154
一、for each底层实现 对于Collection,for each是隐式调用Iterator实现的,效率比显示调用Iterator略低,对于Array,for each是通过对下标引用实现的,效率比for循环要略低。for each返回的是Collection一个对象,因此不能用for eac ...
分类:
编程语言 时间:
2016-08-07 13:43:27
阅读次数:
212
Partition an integers array into odd number first and even number second. 剑指offer的一道题,把所有奇数移动到偶数前面,其实是partition的双端解法,利用双指针。先检测两边合格的元素,都不合格,则交换,继续。 需要注 ...
分类:
其他好文 时间:
2016-08-07 12:33:24
阅读次数:
167
// // 基本数据结构算法 // //二分查找(数组里查找某个元素) function bin_sch($array, $low, $high, $k){ if ( $low <= $high){ $mid = intval(($low+$high)/2 ); if ($array[$mid] = ...
分类:
编程语言 时间:
2016-08-07 11:00:44
阅读次数:
201
传送门 18. 4Sum QuestionEditorial Solution My Submissions Total Accepted: 82006 Total Submissions: 333565 Difficulty: Medium Given an array S of n intege ...
分类:
其他好文 时间:
2016-08-07 09:42:53
阅读次数:
155
数组的定义: JavaScript 中的数组是一种特殊的对象,用来表示偏移量的索引是该对象的属性,索引可能是整数。然而,这些数字索引在内部被转换为字符串类型,这是因为 JavaScript 对象中的属性名必须是字符串。在内部被归类为数组。由于 Array 在 JavaScript 中被当作对象,因此 ...
分类:
编程语言 时间:
2016-08-07 09:37:10
阅读次数:
168
Given an unsorted array of integers, find the length of longest increasing subsequence. For example,Given [10, 9, 2, 5, 3, 7, 101, 18],The longest inc ...
分类:
其他好文 时间:
2016-08-07 06:24:00
阅读次数:
195