会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
红桃J
用心写好每行完美的代码,远比写一堆更有价值
博客园
::
首页
::
博问
::
闪存
::
新随笔
::
联系
::
订阅
::
管理
::
公告
2015年4月22日
leetcode Search for a Range
摘要: 代码: 1 #include 2 #include 3 4 using namespace std; 5 6 int searchSmallest(int A[], int n, int target){ 7 int l = 0; 8 int r = n - 1; 9 w...
阅读全文
posted @ 2015-04-22 22:04 红桃J
阅读(120)
评论(0)
推荐(0)
leetcode Next Permutation
摘要: 我的代码:#include#include#includeusing namespace std;void swap(int &a, int &b){ int t = a; a = b; b = t;}void nextPermutation(vector &num) { i...
阅读全文
posted @ 2015-04-22 21:27 红桃J
阅读(142)
评论(0)
推荐(0)
leetcode Divide Two Integers
摘要: 题目:Divide Two Integers思考方式:刚开始无从下手,tag里的提示是binary search 也就是二分搜索,以前的二分搜索都是知道两端开始向中间靠拢。这里的二分搜索是向右方靠拢, 然后循环的地方在如果越界,就在最后的区间内寻找,可见这种二分搜索的效率是不如那种的。但是这依然是O...
阅读全文
posted @ 2015-04-22 20:12 红桃J
阅读(128)
评论(0)
推荐(0)