139 Word Break纯dpclass Solution: # @param s, a string # @param dict, a set of string # @return a boolean def wordBreak(self, s, dict): ...
分类:
其他好文 时间:
2015-07-22 06:58:25
阅读次数:
111
strategy = $strategy; } public function getPrice(){ return $this->strategy->getPrice(); }}class twoDiscount{ private $price; public function __constr....
分类:
其他好文 时间:
2015-07-22 01:29:21
阅读次数:
108
num1 = $num1; } public function setNum2($num2){ $this->num2 = $num2; } public function getResult(){ return null; }}class add extends operation{ publ.....
分类:
其他好文 时间:
2015-07-22 01:25:12
阅读次数:
178
一、题目Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321二、分析本题基本没有难度,用Python做这种数啊什么的最爽了,不用担心溢出的问题,并且字符串和整数间转换特别顺畅,像...
分类:
其他好文 时间:
2015-07-22 01:24:04
阅读次数:
158
1. 使用new来创建对象(调用构造函数)时,如果return的是非对象(数字、字符串、布尔类型等)会忽而略返回值;如果return的是对象,则返回该对象。2. 重写原型会切断原型链:foo = function(){}foo.proto.x = 3;var foo1 = new foo();ale...
分类:
编程语言 时间:
2015-07-21 23:57:52
阅读次数:
233
1 //isActiveClone防止循环引用 2 function clone(obj) { 3 if (obj === null || typeof obj !== 'object' || 'isActiveClone' in obj) { 4 return obj; ...
分类:
编程语言 时间:
2015-07-21 23:47:25
阅读次数:
191
Given a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For exa...
分类:
其他好文 时间:
2015-07-21 23:44:58
阅读次数:
124
Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.Analyse: Similiar to merge sort algorithm. Reuse the c...
分类:
其他好文 时间:
2015-07-21 23:33:20
阅读次数:
188
Problem Definition:Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3,Return [1,3,3,1].Note:Could you optimize yo...
分类:
其他好文 时间:
2015-07-21 22:11:28
阅读次数:
121
var和const :变量和常量的声明 var varName type 或者 varName : = value package and import: 导入 func: 用于定义函数和方法 return :用于从函数返回 defer someCode :在函数退出之前执行 go : 用于并行 ....
分类:
编程语言 时间:
2015-07-21 22:05:48
阅读次数:
147