Compare methodEither you implement a compare-method for your object:- (NSComparisonResult)compare:(Person *)otherObject { return [self.birthDate co...
分类:
其他好文 时间:
2014-09-20 23:09:39
阅读次数:
263
Implement strStr().Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack.难度:60.这是算法中比较经典的问题,判断一个字...
分类:
其他好文 时间:
2014-09-20 14:02:47
阅读次数:
292
[leetcode]Implement pow(x, n)....
分类:
其他好文 时间:
2014-09-20 10:04:17
阅读次数:
110
原题地址:https://oj.leetcode.com/problems/next-permutation/题意:Implement next permutation, which rearranges numbers into the lexicographically next greater...
分类:
编程语言 时间:
2014-09-20 07:44:56
阅读次数:
241
Implement pow(x, n).Analysis:The most basic idea, x multiply itself n time and return. However, this strait forward approach got time excessed. O(n).N...
分类:
其他好文 时间:
2014-09-20 01:04:26
阅读次数:
207
C语言的math.h中有个函数: double pow(double n,double m);计算n的m次方C语言的math.h中有个函数: double sqrt(double n);计算根号n的值(对n进行开根)C语言中的字符串: char *name="zh"; 输出的时候使用...
分类:
其他好文 时间:
2014-09-19 18:55:05
阅读次数:
165
Implement int sqrt(int x).难度:76,用二分查找。要求是知道结果的范围,取定左界和右界,然后每次砍掉不满足条件的一半,知道左界和右界相遇。算法的时间复杂度是O(logx),空间复杂度是O(1)。 1 public class Solution { 2 public ...
分类:
其他好文 时间:
2014-09-19 13:45:15
阅读次数:
122
1.Implement a functionthat prints the numbers from 1 to 100.But for multiples of three(3) print “Zif”insteadof the number and for the multiples of five(5) print “Nab”. For numbers whichare multiples...
分类:
编程语言 时间:
2014-09-19 12:06:25
阅读次数:
198
本题目要求计算下列分段函数f(x)的值:注:可在头文件中包含math.h,并调用sqrt函数求平方根,调用pow函数求幂。输入格式:输入在一行中给出实数x。输出格式:在一行中按“f(x) = result”的格式输出,其中x与result都保留两位小数。输入样例1:10输出样例1:f(10.00) ...
分类:
其他好文 时间:
2014-09-18 14:30:33
阅读次数:
893
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:getandset.get(key)- Get the valu...
分类:
编程语言 时间:
2014-09-16 03:53:49
阅读次数:
270