摘要: Given an unsorted integer array, find the first missing positive integer. For example,Given [1,2,0] return 3,and [3,4,-1,1] return 2. Your algorithm s 阅读全文
posted @ 2016-03-23 11:33 熊阳 阅读(341) 评论(0) 推荐(0)
摘要: 本文转载自http://www.cnblogs.com/tracylee/archive/2012/12/04/2801519.html string s("xyzzy"); string& rs = s; // 正确,rs指向s 指针没有这样的限制。 string *ps; // 未初始化的指针 阅读全文
posted @ 2016-03-16 02:57 熊阳 阅读(164) 评论(0) 推荐(0)
摘要: Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. The same repeat 阅读全文
posted @ 2016-02-24 23:00 熊阳 阅读(156) 评论(0) 推荐(0)
摘要: 转自:http://blog.csdn.net/lovekatherine/article/details/1778422 三种访问权限 public:可以被任意实体访问 protected:只允许子类及本类的成员函数访问 private:只允许本类的成员函数访问 (友元函数可以访问这三种访问权限的 阅读全文
posted @ 2016-02-17 08:55 熊阳 阅读(277) 评论(0) 推荐(0)
摘要: 1.虚函数 如果不使用virtual关键字,当使用基类的指针p指向派生类的对象是,调用的p的一个方法(比如print)时,调用的是基类里面的print方法。 如果使用virtual关键字,则可以调用派生类里的print方法。 class Base { public:Base(){} public: 阅读全文
posted @ 2016-02-17 08:44 熊阳 阅读(493) 评论(0) 推荐(0)
摘要: 对于外部世界来说,关键字protected和private相似,即在类外部只能通过公有方法访问, 而对于该保护成员所在类的派生类,其性质和public相似,可以在派生类中直接访问。 阅读全文
posted @ 2016-02-17 08:10 熊阳 阅读(1162) 评论(0) 推荐(0)
摘要: 1. const 修饰变量,表示变量的值不会改变: const TYPE ValueName = value; 2. 指针使用const (1)指针本身是常量不变,有以下两种写法: (char*) const pName; (2)指针所指向的内容是常量不变,有以下两种写法: (char) const 阅读全文
posted @ 2016-02-10 04:01 熊阳 阅读(370) 评论(0) 推荐(0)
摘要: 1. 静态全局变量 在全局变量之间加上static关键字,就被定义为静态全局变量。 特点:在全局数据区分配内存 未初始化则被自动初始化为0 在声明它的文件内可见,在声明它之外的文件不可见,其他文件中可使用同名变量 2. 静态局部变量 在局部变量前加上static关键字,就被定义为静态局部变量 特点: 阅读全文
posted @ 2016-02-10 03:36 熊阳 阅读(242) 评论(0) 推荐(0)
摘要: Given a sorted array of integers, find the starting and ending position of a given target value. Your algorithm's runtime complexity must be in the or 阅读全文
posted @ 2015-11-17 08:00 熊阳 阅读(141) 评论(0) 推荐(0)
摘要: Given a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring.For"(()", the longest... 阅读全文
posted @ 2015-11-12 05:46 熊阳 阅读(278) 评论(0) 推荐(0)