会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
Agentgamer
“It only takes 10 seconds to crush a man's ambitions. I need to take care that I protect mine.”
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
4
5
6
7
8
···
13
下一页
2017年5月24日
Roman to Integer
摘要: https://leetcode.com/problems/roman-to-integer/ 罗马数字转整数,罗马数字类型是{'I':1,'V':5,'X':10,'L':50,'C':100,'D':500,'M':1000} 规则是如果把低级别的数放在高级别的左边就是‘减去’,如果放在右边就是
阅读全文
posted @ 2017-05-24 17:34 Agentgamer
阅读(166)
评论(0)
推荐(0)
2017年5月22日
ZigZag Conversion
摘要: https://leetcode.com/problems/zigzag-conversion/#/description 我把这题分成了两个问题。基本思路是:有多少rows要zigzag 就弄多少个数组,所以zigzag 不过就是在这些数组间往返添加元素而已。 所以第一个问题是,如何找出一个数组的
阅读全文
posted @ 2017-05-22 18:01 Agentgamer
阅读(191)
评论(0)
推荐(0)
2017年4月17日
Merge Two Sorted Lists
摘要: 大退步。。用了20分钟T_T l1 / sortedHead->...->sortedTail \ l2
阅读全文
posted @ 2017-04-17 23:20 Agentgamer
阅读(101)
评论(0)
推荐(0)
2017年1月1日
Range Sum Query - Mutable
摘要: https://leetcode.com/problems/range-sum-query-mutable/ 因为数组会变动,所以缓存机制受到了挑战。。。每次更新数组意味着缓存失效,这样一更新一查找的话相当于每次都重新计算了。 所以要设计一个更好的缓存机制,尽量降低更新带来的影响。 我选择分段缓存,
阅读全文
posted @ 2017-01-01 18:23 Agentgamer
阅读(127)
评论(0)
推荐(0)
Range Sum Query - Immutable
摘要: https://leetcode.com/problems/range-sum-query-immutable/ 用缓存撒
阅读全文
posted @ 2017-01-01 18:13 Agentgamer
阅读(103)
评论(0)
推荐(0)
2016年12月30日
Range Sum Query 2D - Immutable
摘要: https://leetcode.com/problems/range-sum-query-2d-immutable/ 条件说sumRegion 会调很多次,如果每次都用双for 循环去累加的话就有太多重复计算了,所以可以实现cache 一下。 可以有两种cache 机制,一种是在初始化的时候就生成
阅读全文
posted @ 2016-12-30 16:10 Agentgamer
阅读(101)
评论(0)
推荐(0)
Integer to English Words
摘要: https://leetcode.com/problems/integer-to-english-words/ 这题记得是《c 和指针》里的一道习题,三年前花了一晚上做过。现在花了大概40 分钟。 我的思路是三位三位的处理。三位与三位之间通过简单的用量级(Thousand, Million, Bil
阅读全文
posted @ 2016-12-30 10:57 Agentgamer
阅读(141)
评论(0)
推荐(0)
2016年9月12日
2016 年8 月小结
摘要: 小结: 增加了运动量,每天步行上下班。用软件做俯卧撑可以做到35 个。 阅读了两本书。 习惯: 养成晚上下班回去先把内务搞完再做到电脑前的习惯。继续保持。 正在执行使用omnifocus 管理日常事务的习惯。 游戏: 战地1beta:10+小时;打到30级,距离对枪的准度影响很大,10米开外子弹基本
阅读全文
posted @ 2016-09-12 20:56 Agentgamer
阅读(101)
评论(0)
推荐(0)
2016年9月9日
一次mongodb 统计需求
摘要: 需求: 临下班运营的同事发来了一个需求,要统计数据库里某个collection的所有document 中某个字段(_id)出现的次数。_id 字段的范围是0-4000。 假设collection 是这样: 那么最终结果:[{_id: 123, value: 2}, {_id:456, value:
阅读全文
posted @ 2016-09-09 18:44 Agentgamer
阅读(1653)
评论(0)
推荐(0)
2016年9月1日
[LeetCode] Find the Difference
摘要: Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter at
阅读全文
posted @ 2016-09-01 16:31 Agentgamer
阅读(129)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
7
8
···
13
下一页
公告