上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 20 下一页

2015年8月23日

摘要: 1、为什么要用enum 写程序时,我们常常需要为某个对象关联一组可选alternative属性.例如,学生的成绩分A,B,C,D等,天气分sunny, cloudy, rainy等等。 更常见的,打开一个文件可能有三种状态:input, output和append. 典型做法是,对应定义3个常数,即... 阅读全文
posted @ 2015-08-23 21:48 月下之风 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 1 const的基本用法 常变量: const 类型说明符 变量名 #在c语言中,仍是一个变量。c++中则变为一个常量,比如可以设置为数组的长度 常引用: const 类型说明符 &引用名 常对象: 类名 const 对象名 常成员函数: 类名::fun(形参) const 常数组: 类型说明符 c 阅读全文
posted @ 2015-08-23 21:40 月下之风 阅读(215) 评论(0) 推荐(0) 编辑
摘要: static 修饰的三种作用(1) 静态局部变量(2) 模块内的全局变量、函数,不可以被其他模块访问(3) 类的静态成员其中(3)只在c++中有。(1) 静态局部变量。局部变量一般在函数体内,局部变量按照存储形式可分为三种auto,static,register 。与auto类型(普通)局部变量相比... 阅读全文
posted @ 2015-08-23 18:47 月下之风 阅读(363) 评论(0) 推荐(0) 编辑
摘要: 1有一苹果,两个人抛硬币来决定谁吃这个苹果,先抛到正面者吃。问先抛这吃到苹果的概率是多少?解答:这种题目一看似乎答案就是1/2,但其实认真细想并没有那么简单。给所有的抛硬币操作从1开始编号,显然先手者只可能在奇数(1,3,5,7…)次抛硬币得到苹果,而后手只可能在偶数次(2,4,6,8…)抛硬币得到... 阅读全文
posted @ 2015-08-23 17:54 月下之风 阅读(2465) 评论(0) 推荐(0) 编辑

2015年7月19日

摘要: Title: 有两个不同大小的二进制树: T1 有上百万的节点; T2 有好几百的节点。请设计一种算法,判定 T2 是否为 T1的子树 阅读全文
posted @ 2015-07-19 21:24 月下之风 阅读(462) 评论(0) 推荐(0) 编辑

2015年7月6日

摘要: Title: Given two integers representing the numerator and denominator of a fraction, return the fraction in string format. If the fractional part is re 阅读全文
posted @ 2015-07-06 16:10 月下之风 阅读(246) 评论(0) 推荐(0) 编辑

2015年6月30日

摘要: Title: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. h 阅读全文
posted @ 2015-06-30 20:32 月下之风 阅读(142) 评论(0) 推荐(0) 编辑

2015年6月6日

摘要: https://leetcode.com/problems/insert-interval/http://www.cnblogs.com/yxzfscg/p/4459173.htmlhttps://leetcode.com/problems/construct-binary-tree-from-pr... 阅读全文
posted @ 2015-06-06 18:38 月下之风 阅读(214) 评论(0) 推荐(0) 编辑
摘要: Title: Given an input string, reverse the string word by word. For example,Given s = "the sky is blue",return "blue is sky the". https://leetcode.com/ 阅读全文
posted @ 2015-06-06 10:52 月下之风 阅读(223) 评论(0) 推荐(0) 编辑

2015年5月29日

摘要: Maximum Product Subarray Title: Find the contiguous subarray within an array (containing at least one number) which has the largest product. For examp 阅读全文
posted @ 2015-05-29 10:59 月下之风 阅读(243) 评论(0) 推荐(0) 编辑
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 20 下一页

导航