
C++
「已注销」
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
整数除法的取整方式
在二分查找中,我们常用到以下表现 int low=x; int high=y; int mid=(low+high)/2; 由于C++在处理整数除法的时候,是向零取整的,即: int a=(1+2)/2;//a=1 int a=(-1-2)/2,//a=-1 故low 由此在有关 的二分查找实现中(类似:Find Peak Element—LeetCode第三种方式点击打开链接),原创 2015-04-11 20:28:01 · 2623 阅读 · 1 评论 -
Lowest Common Ancestor of a Binary Search Tree-leetcode
Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined betw原创 2015-07-19 19:52:37 · 347 阅读 · 0 评论 -
258 Add Digits - LeetCode
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has on原创 2015-08-22 14:04:24 · 337 阅读 · 0 评论