LeetCode: Brick Wall
题目:
There is a brick wall in front of you. The wall is rectangular and has several rows of bricks. The bricks have the same height but different wi[……]
题目:
There is a brick wall in front of you. The wall is rectangular and has several rows of bricks. The bricks have the same height but different wi[……]
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their n[……]
感受到了自己与大神的差距,同样的题,我的代码跑140ms,大神的只要4ms。
Given an array of integers, return indices of the two numbers such that they add up to a specific target.[……]
今天下午闲来无事,用C++写了个往文件开头添加版权信息的命令行工具,命名为 addCopyright 。
已在Ubuntu16.04测试,理论上可以在任何有gcc和make的平台编译运行。
依赖:gcc,make
std:: exception ,定义于头文件 <exception>,它提供一致的接口,以通过 throw 表达式处理错误。
标准库所生成的所有异常继承自 std::exception。
其继承结构如下:
在这里介绍了 stream 流操作中常用的操纵符。其中,前面带*表示为流的默认操纵符。
适合的stream流包括:输入输出流(istream和ostream),文件流(fstream),字符串流(stringstream)等。
注意:不是所有的操作符都适用于所有stream。
C++中的 template 可以用来声明函数模板和类模板,讲到函数模板,就难免想到参数默认值。
以下是几个例子,用来说明,template中参数默认值的使用。
Tuple(元组)是C++11之后的一个类模板,是固定大小的异类值汇集,或者说是通用化的pair。
Types… | – | tuple 所存储的元素的类型。支持空列表。 |
(构造函数) | 构造新的 tuple (公开[……] |