上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 29 下一页
摘要: Implementint sqrt(int x).Compute and return the square root ofx.方法相当2b之前判定超时, 于是用到了class Solution {public: int sqrt(int x) { if(x==0) ... 阅读全文
posted @ 2013-12-18 17:34 海滨银枪小霸王 阅读(130) 评论(0) 推荐(0) 编辑
摘要: Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted from l... 阅读全文
posted @ 2013-12-18 16:56 海滨银枪小霸王 阅读(103) 评论(0) 推荐(0) 编辑
摘要: Given an indexk, return thekthrow of the Pascal's triangle.For example, givenk= 3,Return[1,3,3,1].Note:Could you optimize your algorithm to use onlyO(... 阅读全文
posted @ 2013-12-18 16:41 海滨银枪小霸王 阅读(112) 评论(0) 推荐(0) 编辑
摘要: GivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]... 阅读全文
posted @ 2013-12-18 16:28 海滨银枪小霸王 阅读(113) 评论(0) 推荐(0) 编辑
摘要: You are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb... 阅读全文
posted @ 2013-12-18 14:42 海滨银枪小霸王 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 本人使用环境: ubuntu13.10 64bit记录一些实用的命令:1. du -sh dir 查询dir的总大小, 有时要sudo du -Sh dir 查询dir各目录的大小, 有时sudo2. 安装rsapip install rsaeasy_install rsa这两个应该还可以安... 阅读全文
posted @ 2013-12-18 12:07 海滨银枪小霸王 阅读(77) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,3,2].Note... 阅读全文
posted @ 2013-12-17 23:39 海滨银枪小霸王 阅读(79) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest le... 阅读全文
posted @ 2013-12-17 23:17 海滨银枪小霸王 阅读(73) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth... 阅读全文
posted @ 2013-12-17 22:14 海滨银枪小霸王 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 做ACM时, 时常用到这两个数据结构, 特别是处理树, 图等操作时, 似乎已经必不可缺了. 若自我构造, 则耗时巨多, 且效率堪忧. 故灵活运用, 即可如鱼得水, 信手拈来. 特记之#include#includestd:queuestd:stackusing namespace std;q... 阅读全文
posted @ 2013-12-17 10:19 海滨银枪小霸王 阅读(128) 评论(0) 推荐(0) 编辑
上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 29 下一页