上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 72 下一页
摘要: Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were initia 阅读全文
posted @ 2018-12-26 12:28 乐乐章 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 用法 1、sort函数可以三个参数也可以两个参数,必须的头文件#include < algorithm>和using namespace std; 2、它使用的排序方法是类似于快排的方法,时间复杂度为n*log2(n) 3、Sort函数有三个参数:(第三个参数可不写) (1)第一个是要排序的数组的起 阅读全文
posted @ 2018-12-25 12:54 乐乐章 阅读(874) 评论(0) 推荐(0) 编辑
摘要: Given a collection of intervals, merge all overlapping intervals. Example 1: Input: [[1,3],[2,6],[8,10],[15,18]] Output: [[1,6],[8,10],[15,18]] Explan 阅读全文
posted @ 2018-12-25 12:36 乐乐章 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 适配器模式:将一个类的接口转换成客户希望的另外一个接口。Adapter模式使得原来由于接口不兼容而不能一起工作的那些类可以一起工作。 角色: (1)Target:这是客户所期待的接口,Target可以是具体的或抽象的类,也可以是接口。 (2)Adaptee:需要适配的类。 (3)Adapter:通过 阅读全文
posted @ 2018-12-24 16:14 乐乐章 阅读(832) 评论(0) 推荐(0) 编辑
摘要: Determine if a 9x9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules: Each row must contain the digit 阅读全文
posted @ 2018-12-24 15:18 乐乐章 阅读(157) 评论(0) 推荐(0) 编辑
摘要: set c++ 如何检查一个元素是否在std :: set? 有一个更简单的等价的下面的代码: myset.find(x) != myset.end() 有一个更简单的等价的下面的代码: 检查许多STL容器中的存在的典型方法是: const bool is_in = container.find(e 阅读全文
posted @ 2018-12-24 14:41 乐乐章 阅读(1211) 评论(0) 推荐(0) 编辑
摘要: 状态模式包含如下角色: Context: 环境类 State: 抽象状态类 ConcreteState: 具体状态类 2)适用场景: a)状态模式主要解决的是当控制一个对象状态转换的条件表达式过于复杂时的情况。把状态的判断逻辑转移到表示不同状态的一系列类中,可以把复杂的判 断逻辑简单化。(简单来说, 阅读全文
posted @ 2018-12-23 22:50 乐乐章 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 1、int 2 string 法1:c++11里面的to_string 法2: 2 string 2 int https://www.cnblogs.com/gaobw/p/7070622.html 阅读全文
posted @ 2018-12-23 15:08 乐乐章 阅读(162) 评论(0) 推荐(0) 编辑
摘要: The count-and-say sequence is the sequence of integers with the first five terms as following: 1. 1 2. 11 3. 21 4. 1211 5. 111221 1 is read off as "on 阅读全文
posted @ 2018-12-23 14:42 乐乐章 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 为了更清晰地理解工厂方法模式,需要先引入两个概念: 产品等级结构 :产品等级结构即产品的继承结构,如一个抽象类是电视机,其子类有海尔电视机、海信电视机、TCL电视机,则抽象电视机与具体品牌的电视机之间构成了一个产品等级结构,抽象电视机是父类,而具体品牌的电视机是其子类。 产品族 :在抽象工厂模式中, 阅读全文
posted @ 2018-12-22 22:20 乐乐章 阅读(896) 评论(0) 推荐(0) 编辑
上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 72 下一页