根据Jikai Tang的网站和视频总结如下, http://www.tangjikai.com/algorithms/leetcode-binary-search 1. 在sorted array里面找一个特定的数。 由于left和right可以相等,所以L2使用的是while l <= r。L3 ...
分类:
其他好文 时间:
2017-02-05 12:31:53
阅读次数:
143
https://leetcode.com/problems/remove-duplicates-from-sorted-array/ Given a sorted array, remove the duplicates in place such that each element appear ...
分类:
其他好文 时间:
2017-02-05 12:25:20
阅读次数:
160
在官方的文档有这么一端说明: Note a difference between 5.2 and 5.3 versions echo (int)strcmp('pending',array()); will output -1 in PHP 5.2.16 (probably in all versi... ...
分类:
其他好文 时间:
2017-02-05 10:54:09
阅读次数:
230
php中很少使用的函数,了解一下还是好的。主要功能都是比较数组,返回数组交集。array_uintersect(array1,array2,string);作用:自定义函数比较俩个或者多个数组,只比较value参数:array1:被比较的数组1array2:比较的数组2string:自定义函数名返回值:返回数组的交集例子:比..
分类:
编程语言 时间:
2017-02-05 01:10:57
阅读次数:
166
1、不用新变量直接交换现有两个变量的值 (1)list($a,$b)=array($b,$a);(2)a=a+b,b=a-b,a=a-b 2、PHP数字金额转大小格式,同时说明思路 function daxie($num){ $da_num = array('零','一','二','三','四',' ...
分类:
Web程序 时间:
2017-02-04 23:03:26
阅读次数:
434
Given an array of integers sorted in ascending order, find the starting and ending position of a given target value.Your algorithm's runtime complexit... ...
分类:
其他好文 时间:
2017-02-04 19:00:59
阅读次数:
268
var htmls = new Array(); htmls.push("<tr class='otherinfotr'>");htmls.push("<td>姓名</td>");htmls.push("<td>");htmls.push("<input type='text' name='user ...
分类:
编程语言 时间:
2017-02-04 16:28:00
阅读次数:
146
1、数组的创建 var arrayObj = new Array(); //创建一个数组var arrayObj = new Array([size]); //创建一个数组并指定长度,注意不是上限,是长度var arrayObj = new Array([element0[, element1[, ...
分类:
编程语言 时间:
2017-02-04 16:24:23
阅读次数:
184
<?php $array=array(1,2,3,6=>7,8,9,5,10); echo count($array); //输出8 echo " "; echo sizeof($array); //输出8 print_r($array); ?> result: 8 8Array ( [0] => ...
分类:
编程语言 时间:
2017-02-04 12:31:00
阅读次数:
165
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are... ...
分类:
其他好文 时间:
2017-02-04 12:25:18
阅读次数:
226