Implement pow(x, n).解题思路:直接使用乘法实现即可,注意下,如果n很大的话,递归次数会太多,因此在n=10和n=-10的地方设置一个检查点,JAVA实现如下:static public double myPow(double x, int n) { if(n==1)...
分类:
编程语言 时间:
2015-05-15 01:07:33
阅读次数:
200
Problem:
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.
If such arrangement is not possible, it must rearrange it as the l...
分类:
编程语言 时间:
2015-05-14 16:38:48
阅读次数:
146
// 为element增加一个样式名为newClassName的新样式function addClass(element, newClassName) { // your implement var oldClassName=element.className; element.c...
分类:
编程语言 时间:
2015-05-14 13:58:03
阅读次数:
717
1 Next Permutation
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must rearrange it as the...
分类:
编程语言 时间:
2015-05-14 12:08:12
阅读次数:
154
Given an array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra...
分类:
其他好文 时间:
2015-05-13 22:01:30
阅读次数:
138
题目描述:Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Update (2014-11-02):T...
分类:
其他好文 时间:
2015-05-13 16:13:05
阅读次数:
100
PHP语言是一个功能强大的嵌入式HTML脚本语言,它的易用性让许多程序员选择使用。PHP判断字符串的包含,可以使用PHP的内置函数strstr,strpos,stristr直接进行判断.也可以通过explode函数的作用写一个判断函数。1. strstr: 返回一个从被判断字符开始到结束的字符串,如...
分类:
Web程序 时间:
2015-05-13 14:41:16
阅读次数:
126
function uniqArray(arr) { // your implement for(var i=0;i<arr.length;i++) for(var j=i+1;j<arr.length;j++) { if(arr[i]===arr[j]){ ...
分类:
编程语言 时间:
2015-05-12 22:38:55
阅读次数:
129
1、strpos函数strpos(string,find,start)例子:输出world3、strstr函数strstr() 函数搜索一个字符串在另一个字符串中的第一次出现。该函数返回字符串的其余部分(从匹配点)。如果未找到所搜索的字符串,则返回 false。strstr('zhang@jbxue...
分类:
其他好文 时间:
2015-05-12 22:19:18
阅读次数:
121
Problem:
Implement strStr().
Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.
Update (2014-11-02):
The signature of the function ha...
分类:
编程语言 时间:
2015-05-12 13:39:34
阅读次数:
138