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 your algorithm to use only O(k) extra space?
思路:最简单的方法就是按...
分类:
其他好文 时间:
2014-06-18 12:40:54
阅读次数:
265
题目
Given a linked list, swap every two adjacent nodes and return its head.
For example,
Given 1->2->3->4, you should return the list as 2->1->4->3.
Your algorithm should use only const...
分类:
其他好文 时间:
2014-06-18 11:53:39
阅读次数:
138
Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.
For example,
If n = 4 and k = 2, a solution is:
[
[2,4],
[3,4],
[2,3],
[1,2],
[1,3],
[1,4],
]...
分类:
其他好文 时间:
2014-06-18 11:41:52
阅读次数:
156
题目
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
For example, given n = 3, a solution set is:
"((()))", "(()())", "(())()", "()...
分类:
其他好文 时间:
2014-06-17 22:59:06
阅读次数:
223
题目
Given a linked list, remove the nth node from the end of list and return its head.
For example,
Given linked list: 1->2->3->4->5, and n = 2.
After removing the second node from th...
分类:
其他好文 时间:
2014-06-17 21:38:12
阅读次数:
193
因为需要,我创建了一个脚本叫 wf.sh (随意起什么名字),它可以读取当前目录下的 config.ini 配置文件来解析并执行工作流任务(Workflow)。
直接上代码:
config.ini
Workflow.Name = example
Workflow.Description = my work flow example \n and I know what's g...
分类:
其他好文 时间:
2014-06-17 19:18:30
阅读次数:
293
一位网友问我如何在Linux的Qt的应用程序中输入中文,我一开始觉得不是什么问题,但是后面自己尝试了一下还真不行。不仅是Qt制作的应用程序,就连Qt Creator都无法支持。后面看了一些资料,了解了Qt应用程序的方法,这里和大家分享一下。...
分类:
系统相关 时间:
2014-06-17 18:58:15
阅读次数:
370
大家都知道C++虚函数的机制,对于基类定义为虚函数的地方,子类如果覆写,在基类指针或者引用来指向子类的时候会实现动态绑定。
但如果指针去调用非虚函数,这个时候会调用C++的静态绑定,去判断当前的指针是什么类型,就去执行哪个类型的函数。
很有一种比较经典的用法,就是Template Method模式,基类定义一个非虚的算法框架,里面具体定义一些纯虚的函数片段,由子类来进行实现,从...
分类:
编程语言 时间:
2014-06-17 18:48:34
阅读次数:
325
具体代码
###############################
#
# Funciton: micro_template_compile
#
# Parameter:
# [1] => template :String
# [2..n] => values for placeholder as key=value
#
# Example:
# <- micro_tem...
分类:
其他好文 时间:
2014-06-17 16:23:47
阅读次数:
172
Qt是一个由奇趣科技开发的跨平台C++图形用户界面应用程序开发框架。它既可以开发GUI程式,也可用于开发非GUI程式,比如控制台工具和服务器。Qt是面向对象语言,易于扩展,并且允许组件编程。Qt是一个著名的C++库,使用Qt,在一定程度上让你获得的是一个“一站式”的服务。
Qt 的良好封装机制使得 Qt 的模块化程度非常高,可重用性较好,对于用户开发来说是非常方便的。 Qt 提供了一种称为...
分类:
其他好文 时间:
2014-06-17 16:03:33
阅读次数:
171