会员
周边
捐助
新闻
博问
闪存
赞助商
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
canexjtuzju
记录
Powered by
博客园
博客园
|
首页
|
新随笔
|
联系
|
订阅
|
管理
2014年8月9日
LeetCode--Merge Intervals
摘要: 简单题:先按左左边排序,然后对输入的区间和当前结果合并 1 /** 2 * Definition for an interval. 3 * struct Interval { 4 * int start; 5 * int end; 6 * Interval() : ...
阅读全文
posted @ 2014-08-09 20:33 canexjtuzju
阅读(171)
评论(0)
推荐(0)
编辑
LeetCode--Valid Number
摘要: 这道题真心是难度比较大,不是算法难度,是实现难度,各种case都得考虑到。我没有A过,一开始就把.1这种case当做是错误的。导致程序逻辑乱套了。下面是别人的代码: 1 class Solution { 2 public: 3 bool isNumber(const char *s) { 4...
阅读全文
posted @ 2014-08-09 20:13 canexjtuzju
阅读(165)
评论(0)
推荐(0)
编辑
LeetCode--Max Points on a Line
摘要: 思路:时间复杂度:O(n^2),挨个遍历。暴力搜索。但是有几点要注意:第一,map的斜率是float,所以,为了不损失精度,求斜率先把int-》float,再相除;第二,注意处理为空和为0的情况。为1是返回0还是1,这个和面试官交流,leetcode上面是返回1 1 /** 2 * Definit...
阅读全文
posted @ 2014-08-09 18:42 canexjtuzju
阅读(170)
评论(0)
推荐(0)
编辑
1.1
摘要: 1.1 Implement an algorithm to determine if a string has all unique characters. Whatif you cannot use additional data structures? 1 #include 2 #includ...
阅读全文
posted @ 2014-08-09 16:28 canexjtuzju
阅读(171)
评论(0)
推荐(0)
编辑