Contents

ARST打卡第153周[153/521]

Algorithm

lc804唯一摩尔斯密码词

简单遍历翻译,然后放入集合,最终返回集合的size

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
class Solution {
    unordered_set<string> mos_set;
public:
    int uniqueMorseRepresentations(vector<string>& words) {
        string s[] = {".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."};
        vector<string> word2Mos(s, s + 26);
        string tmp;
        for (auto& x : words) {
            tmp.clear();
            for (auto y : x) {
                tmp += word2Mos[y - 'a'];
            }
            mos_set.insert(tmp);
        }
        return mos_set.size();
    }
};

Review

samba的waf编译系统

其实有很多东西还没讲清楚,还是要去看里面的源码才能比较多的理解

果然是源码面前,了无秘密

Tips

将paxos和raft统一到一个协议下:abstract-paxos

其中核心主要是多节点协作状态

Share

samba waf编译系统链接新的库必须进行声明

1
2
3
4
5
6
7
if bld.env.XXX:
+   ## 下面这句是把my_lib声明为系统库,非常重要,研究了2天waf和samba改造的waf,然后还是回到代码级加日志调试类别其他的库才找到根源
+   conf.CHECK_LIB('my_lib', shlib=True)
    bld.SAMBA_SUBSYSTEM('XXXXXY',
                         source='xxx.c',
-                        deps='Xthread Yplace some-util')
+                        deps='Xthread my_lib Yplace some-util')