摘要: 停时定理跟之前的投硬币问题有点关系。 鞅和停时定理:http://snarc.ia.ac.cn/ren/html/y2010/407.html 圈套:http://www.eaglefantasy.com/archives/111 不那么随机的随机数列:http://blog.codingnow.com/2008/04/quasi-random_sequences.html ... 阅读全文
posted @ 2012-10-07 22:04 紫红的泪 阅读(1743) 评论(0) 推荐(0) 编辑
摘要: 题意是旋转正方形矩形。右旋90度,要求O(1)空间复杂度。 // Rotate a round which top & left is topleft, bottom & right is bottomright. void rotate(vector<vector<int> > &matrix, size_t topleft, size_t bottomrig... 阅读全文
posted @ 2012-10-07 21:35 紫红的泪 阅读(2879) 评论(0) 推荐(0) 编辑
摘要: 做过不少题,比较系统的有LeetCode系列、POJ系列、Interview Street Challenges系列。自己总结的有简明排序代码、八皇后N解、逆序数相关题等。其他题还比较散,等十月份面试高峰期过了就系统的总结总结。 阅读全文
posted @ 2012-10-07 16:19 紫红的泪 阅读(1211) 评论(0) 推荐(0) 编辑
摘要: 1, The Triangle (POJ 1163) 2, Function Run Fun (POJ 1579) 3, Recaman's Sequence (POJ 2081) 4, World Cup Noise (POJ 1953) 5, Strange Towers of Hanoi (POJ 1958) 6, Common Subsequence (POJ 1458) 7,... 阅读全文
posted @ 2012-10-07 16:12 紫红的泪 阅读(681) 评论(0) 推荐(0) 编辑
摘要: LeetCode: http://www.leetcode.com/onlinejudge, Note: (Added 9/18/2012)3Sum3Sum Closest4SumAdd BinaryAdd Two NumbersAnagramsBalanced Binary TreeBinary Tree Inorder TraversalBinary Tree Level Order TraversalBinary Tree Level Order Traversal IIBinary Tree Zigzag Level Order TraversalClimbing StairsComb 阅读全文
posted @ 2012-10-07 15:47 紫红的泪 阅读(1698) 评论(0) 推荐(0) 编辑
摘要: 还是把矩阵中值为0的点的行列都置零,上次是开辟了额外空间,这次要求O(1)的空间复杂度。 void setZeroes(vector<vector<int> > &matrix) { bool bColZero = false, bRowZero = false; if (matrix.size() == 0 || ... 阅读全文
posted @ 2012-10-07 14:13 紫红的泪 阅读(1865) 评论(0) 推荐(0) 编辑