外观模式通过创建新的对象访问接口,从而隐藏对象内部发复复杂性 介绍 外观模式属于结构型模式,通过定义的外观器,从而简化了具体对象的内部复杂性。这种模式通过在复杂系统和上层调用之间添加了一层,这一层对上提供简单接口,对下执行复杂操作。 类图描述 通过上图我们可以发现, IShape 为行为接口,然后 ...
分类:
其他好文 时间:
2018-12-24 20:59:10
阅读次数:
130
这是悦乐书的第 209 次更新,第 221 篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第77题(顺位题号是367)。给定正整数num,写一个函数,如果num是一个完美的正方形,则返回True,否则返回False。例如: 输入:16 输出:true 输入:14 输出: ...
分类:
编程语言 时间:
2018-12-22 20:35:51
阅读次数:
194
Python里面有个很棒的语法糖(syntactic sugar),它就是 list comprehension ,有人把它翻译成“列表推导式”,也有人翻译成“列表解析式”。名字听上去很难理解,但是看它的语法就很清晰了。虽然名字叫做 list comprehension,但是这个语法同样适用于dic ...
分类:
编程语言 时间:
2018-12-22 01:30:38
阅读次数:
201
匿名函数:为了解决功能简单的函数而设计的一句话函数 格式说明 ...
分类:
编程语言 时间:
2018-12-19 13:16:45
阅读次数:
200
Sudoku In the game of Sudoku, you are given a large 9 × 9 grid divided into smaller 3 × 3 subgrids. For example,Given some of the numbers in the grid, ...
分类:
其他好文 时间:
2018-12-17 22:38:26
阅读次数:
217
aggregation 聚合、聚集 algorithm 算法 alias 别名 align 排列、对齐 allocator 分配器、配置器 angle bracket 尖括号 annotation 注解、评注 background bracket (square brakcet) build cac ...
分类:
其他好文 时间:
2018-12-15 00:22:16
阅读次数:
196
package main import "fmt" func main() { sum := 0 sum2 := 0 for i := 1; i <= 100; i++ { sum += i sum2 += i * i } fmt.Println(sum*sum - sum2) } 结果:25164 ...
分类:
其他好文 时间:
2018-12-09 20:39:19
阅读次数:
144
On an infinite number line (x-axis), we drop given squares in the order they are given. The i-th square dropped (positions[i] = (left, side_length)) i ...
分类:
其他好文 时间:
2018-12-01 20:13:02
阅读次数:
219
四平方和定理 维基百科地址:https://zh.wikipedia.org/wiki/%E5%9B%9B%E5%B9%B3%E6%96%B9%E5%92%8C%E5%AE%9A%E7%90%86 四平方和定理 (英语:Lagrange's four-square theorem) 说明每个正整数均 ...
分类:
其他好文 时间:
2018-12-01 17:06:39
阅读次数:
328
Given a square array of integers A, we want the minimum sum of a falling path through A. A falling path starts at any element in the first row, and ch ...
分类:
其他好文 时间:
2018-12-01 16:57:22
阅读次数:
209