2014年11月26日

Leecode -- TwoSum

摘要: question:Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of t... 阅读全文

posted @ 2014-11-26 23:41 沉甸甸的蛋疼 阅读(122) 评论(0) 推荐(0) 编辑

2014年11月24日

第十一章:使用类

摘要: 1、运算符重载 operator+ (take '+' for example) (1) 重载后必须至少有一个用户定义的操作数(struct class etc...),防止把一个C++标准的‘-’重载成'+' (2) 不能违反运算符原来的句法规则; 例如不能将'%'重载成一个操作数 (3)... 阅读全文

posted @ 2014-11-24 02:05 沉甸甸的蛋疼 阅读(94) 评论(0) 推荐(0) 编辑

2014年11月13日

Leetcode -- Sqrt(x)

摘要: 题目:Implementint sqrt(int x).Compute and return the square root ofx思路:1、利用二分法查找 2、Discuss里面贴了一些利用移位做的方法;BTW: C++11定义的Sqrt函数 from double sqrt (doubl... 阅读全文

posted @ 2014-11-13 01:13 沉甸甸的蛋疼 阅读(175) 评论(0) 推荐(0) 编辑

导航