First I was stuck at how to represent state of "add all except i".. but after checking editorial, it is simply inverted Coin Change problem..#include ...
分类:
其他好文 时间:
2015-07-07 07:03:50
阅读次数:
120
1.定义Compose objects into tree structures to represent part-whole hierarchies.Composite lets clients treat individual objects and compositions of objec...
分类:
其他好文 时间:
2015-07-07 00:45:47
阅读次数:
127
Given a digit string, return all possible letter combinations that the number could represent.
A mapping of digit to letters (just like on the telephone buttons) is given below.
Input:Digit st...
分类:
其他好文 时间:
2015-07-04 14:02:10
阅读次数:
282
1. Question给一个数字字符串,按照电话上各个数字对应的字母,返回该字符串代表的所有可能的字母组合。Given a digit string, return all possible letter combinations that the number could represent.A ...
分类:
其他好文 时间:
2015-07-03 23:23:10
阅读次数:
121
访问者模式:
定义了一个作用于一个类的一些操作,访问者模式允许在不改变类的前提下增加一些操作。
Represent an operation to be performed on the elements of an object structure. Visitor lets you define a new operation without changing the classes of...
分类:
其他好文 时间:
2015-07-01 16:00:10
阅读次数:
157
首先看下objc.h里面的定义 1 /// Type to represent a boolean value. 2 #if !defined(OBJC_HIDE_64) && TARGET_OS_IPHONE && __LP64__ 3 typedef bool BOOL; 4 #else 5 t...
分类:
其他好文 时间:
2015-06-30 20:05:45
阅读次数:
110
Number of 1 Bits
Write a function that takes an unsigned integer and returns the number of ’1’ bits it has (also known as the Hamming weight).For example, the 32-bit integer ’11’ has binary represent...
分类:
其他好文 时间:
2015-06-26 12:54:20
阅读次数:
104
Given a binary tree containing digits from 0-9 only, each root-to-leaf path
could represent a number.
An example is the root-to-leaf path 1->2->3 which represents the number 123.
Find the tota...
分类:
其他好文 时间:
2015-06-26 09:22:17
阅读次数:
89
无向图的深度优先遍历的实现,无向图用邻接表表示无向图的表示:邻接矩阵和邻接表。程序使用的示例图为:
实现要点:
每个节点有三种状态-1,0,1,分别表示未发现,已经发现,已经处理。代码如下:#include
#include
#include "graph_represent.h"//后序遍历图
void DFS(struct vNode** adj,i...
分类:
编程语言 时间:
2015-06-22 17:55:45
阅读次数:
227
这里记录一下无向图的广度优先遍历,无向图用邻接表表示,使用的图的示例图如下,关于图的表示可以参照博客:无向图的表示:邻接矩阵和邻接表,这里不再赘述,无向图的表示的代码被封装到头文件queue.h 中。
另外还涉及到C语言的队列问题,可以参照博客:C 循环队列实现,同样不再赘述,循环队列实现的代码被封装到头文件graph_represent.h 中。程序使用示例图:
实现要点:
每个定点有三个状...
分类:
编程语言 时间:
2015-06-22 16:22:52
阅读次数:
367