每周完成一个ARTS:(Algorithm、Review、Tip、Share, ARTS)**
- Algorithm 每周至少做一个 leetcode 的算法题-主要是为了编程训练和学习
- Review 阅读并点评至少一篇英文技术文章-主要是为了学习英文,如果你的英文不行,你基本上无缘技术高手
- Tip 学习至少一个技术技巧-主要是为了总结和归纳你在是常工作中所遇到的知识点
- Share – 分享一篇有观点和思考的技术文章-主要是为了建立你的影响力,能够输出价值观
Algorithm
Algorithm url:https://leetcode.com/problems/jewels-and-stones/
You’re given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to know how many of the stones you have are also jewels.
The letters in J are guaranteed distinct, and all characters in J and S are letters. Letters are case sensitive, so “a” is considered a different type of stone from “A”.
Example 1:
Input: J = “aA”, S = “aAAbbbb”
Output: 3
Example 2:
Input: J = “z”, S = “ZZ”
Output: 0
Note:
S and J will consist of letters and have length at most 50.
The characters in J are distinct.
My Answer:
class Solution {
public int numJewelsInStones(String J, String S) {
int totalNum = 0 ;
HashSet hs = new HashSet();
for (char c : J.toCharArray()){
hs.add(c);
}
for (char c : S.toCharArray()){
if (hs.contains(c)){
totalNum++;
}
}
return totalNum;
}
}
Review
ElasticSearch install
1.ELK版本必须一致
2.安装顺序如下:
- Elasticsearch
- Kibana
- Logstash
- Beats
- APM Server
- Elasticsearch Hadoop
TIPS
1.工作中复杂的事情丢给别人做,自己多学些知识
2.mysql中增加索引也会有慢查询,需要减少全索引搜索次数和回表次数,
方法有很多,可以增加虚列
SHARE
文章:MySQL 性能调优——数据库的分库分表
1.分库分表两种方式:水平和垂直拆分(一般都用水平拆分)
2.介绍了数据库分片方案和分片工具oneProxyp
3.mycat用的也挺多的