1> 类访问修饰符修饰符class类名称extends父类名称implement接口名称(访问修饰符与修饰符的位置可以互换)访问修饰符名称说明备注public可以被所有类访问(使用)public类必须定义在和类名相同的同名文件中package可以被同一个包中的类访问(使用)默认的访问权限,可以省略此...
分类:
编程语言 时间:
2014-11-20 16:57:25
阅读次数:
287
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-11-20 13:39:25
阅读次数:
289
LRU CacheDesign and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:getandset.get(key)- Get...
分类:
系统相关 时间:
2014-11-19 20:29:44
阅读次数:
289
一道LeetCode OJ上的题目,要求设计一个LRU(Least Recently Used)算法,题目描述如下:Design and implement a data structure for Least Recently Used (LRU) cache. It should support...
分类:
编程语言 时间:
2014-11-19 13:51:25
阅读次数:
222
Implement pow(x, n).
原题链接:https://oj.leetcode.com/problems/powx-n/
public double pow(double x, int n) {
if(n== 0)
return 1;
if(n == 1)
return x;
if(n % 2 ==0)
return pow(x*x,n/2);
...
分类:
其他好文 时间:
2014-11-19 11:19:53
阅读次数:
135
在区间(0,100),二次导数恒大于0,f(x)有极小值,用一次导数求极小值点;
#include
#include
#include
#include
const double eps=1e-6;
double f(double x,double y)
{
return 6*pow(x,7)+8*pow(x,6)+7*pow(x,3)+5*pow(x,2)-y*x;
}
doubl...
分类:
其他好文 时间:
2014-11-19 11:18:59
阅读次数:
242
在区间(0,100),二次导数恒大于0,f(x)有极小值,用一次导数求极小值点;
#include
#include
#include
#include
const double eps=1e-6;
double f(double x,double y)
{
return 6*pow(x,7)+8*pow(x,6)+7*pow(x,3)+5*pow(x,2)-y*x;
}
doubl...
分类:
其他好文 时间:
2014-11-19 01:20:07
阅读次数:
167
Implement pow(x, n).
原题链接:https://oj.leetcode.com/problems/powx-n/
public double pow(double x, int n) {
if(n== 0)
return 1;
if(n == 1)
return x;
if(n % 2 ==0)
return pow(x*x,n/2);
...
分类:
其他好文 时间:
2014-11-19 01:19:41
阅读次数:
157
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 si...
分类:
其他好文 时间:
2014-11-18 23:34:46
阅读次数:
180
题目描述:
Implement strStr().
Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.
代码:
int Solution::strStr(char *haystack, char *needle)
{
...
分类:
其他好文 时间:
2014-11-18 11:47:35
阅读次数:
161