9.2 构造方法
python 中也属于自己的构造函数和析构函数,
class fibs:
def __init__(self):
self.a = 0
self.b = 1
def next(self):
self.a,self.b = self.b,self.a+self.b
return self.a
def __iter__(self):
return sel...
分类:
编程语言 时间:
2014-05-07 05:51:56
阅读次数:
500
[Question]
Given an array of integers, find two numbers such that they add up to a specific target number.
The function twoSum should return indices of the two numbers such that they add up to t...
分类:
其他好文 时间:
2014-05-07 05:37:44
阅读次数:
278
原文:
Write code to reverse a C-Style String. (C-String means that “abcd” is represented as five characters, including the null character.)
译文:
写代码翻转一个C风格的字符串。(C风格的意思是"abcd"需要用5个字符来表示,包含末尾的 结束字符)...
分类:
其他好文 时间:
2014-05-07 05:12:34
阅读次数:
265
第一步: 首先添加权限:
第二步:代码实现如下:
public class ScreenActivity extends Activity
{
PowerManager powerManager = null;
WakeLock wakeLock = null;
@Override
protecte...
分类:
移动开发 时间:
2014-05-07 05:00:06
阅读次数:
377
题目
Given a binary tree, return the preorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
2
/
3
return [1,2,3].
Note: Recursiv...
分类:
其他好文 时间:
2014-05-07 03:30:19
阅读次数:
254
第一:点击新建之后,顶级部门显示当前的上级部门而不是最顶级的NULL
parentId有值就可以回显所以代码如下:
1、新建按钮的链接需要更改:
2.相应的Action 不需要修改,因为parentId 在点击相应的上级部门查看其下级部门时它的parentId就已经放到model的值栈里去了,所以可以直接用%{}OGNL表达式取得。
查看下级部门代码:...
分类:
其他好文 时间:
2014-05-07 03:11:59
阅读次数:
264
五一中间断了几天,开始继续。。。
1、
??
Copy List with Random Pointer
A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.
Return a...
分类:
其他好文 时间:
2014-05-06 18:54:59
阅读次数:
386
Oracle常用函数1、NVL()函数语法:NVL(expr1,expr2)含义:如果expr1的计算结果为null值,则NVL()返回expr2。如果expr1的计算结果不是null值,则返回expr1.expr1和expr2可以是任意一种数据类型。如果expr1与expr2的结果皆为null值,则NVL()返回null。返回值类型:字符型、日期型..
分类:
数据库 时间:
2014-05-06 17:22:42
阅读次数:
530
简单的说,递归就是函数自己调用自己。在数据结构里面会经常使用递归,因为递归代码比较简洁优雅,易懂。编写递归程序时主要注意三点(1)递归总有一个最简单的情况,方法的第一条语句总是包含return的条件语句(2)递归调用总是去尝试解决一个规模更小的子问题,这样递归才能..
分类:
其他好文 时间:
2014-05-06 15:46:13
阅读次数:
289
--oracle实现自增id
--创建一张T_StudentInfo表
create table T_StudentInfo
(
"id" integer not null primary key,
xsName nvarchar2(120) not null,
xsAge integer not null,
Mobile varchar(...
分类:
数据库 时间:
2014-05-06 15:04:22
阅读次数:
525