每周至少做一个 leetcode 的算法题、阅读并点评至少一篇英文技术文章、学习至少一个技术技巧、分享一篇有观点和思考的技术文章。(也就是 Algorithm、Review、Tip、Share 简称ARTS)你需要坚持至少一年。
- Algorithm:两数之和
leecode里最简单的算法题,以前没有刷过算法吖
class Solution {
public int[] twoSum(int[] nums, int target) {
for (int i = 0; i < nums.length; i++) {
for (int j = 0; j < nums.length; j++) {
if((nums[i] + nums[j] == target) && i!=j) {
return new int[]{i,j};
}
}
}
throw new IllegalArgumentException("No two sum solution");
}
}
class Solution {
public int[] twoSum(int[] nums, int target) {
Map<Integer, Integer> map = new HashMap<>();
for (int i = 0; i < nums.length; i++) {
int complement = target - nums[i];
if (map.containsKey(complement)) {
return new int[] { map.get(complement), i };
}
map.put(nums[i], i);
}
throw new IllegalArgumentException("No two sum solution");
}
}
- Review:
https://www.usenix.org/conference/osdi18/presentation/gjengset
Noria: dynamic, partially-stateful data-flow for high-performance web applications
这是从the morning paper 摸过去的一片论文,是介绍开源数据库项目Noria,其实看不太懂。。作者那mysql mongodb来对比
- Tip:微信小程序第一次接触,开发版跑起来了,CQQ版的小程序《最爱梵高》,下周的目标是给律师盆友做一款能介绍自己当名片使用的小程序.
- Share:极客时间里的专栏王铮的《数据结构和算法》真心不错