天天看點

ARTS-第一周(2019.06.30)每周完成一個ARTS:(Algorithm、Review、Tip、Share, ARTS)**

每周完成一個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.安裝順序如下:

  1. Elasticsearch
  2. Kibana
  3. Logstash
  4. Beats
  5. APM Server
  6. Elasticsearch Hadoop

TIPS

1.工作中複雜的事情丢給别人做,自己多學些知識

2.mysql中增加索引也會有慢查詢,需要減少全索引搜尋次數和回表次數,

方法有很多,可以增加虛列

SHARE

文章:MySQL 性能調優——資料庫的分庫分表

1.分庫分表兩種方式:水準和垂直拆分(一般都用水準拆分)

2.介紹了資料庫分片方案和分片工具oneProxyp

3.mycat用的也挺多的

繼續閱讀