ARTS 第十二周

发布于 August 30, 2019

Algorithm

46. Permutations

Given a collection of distinct integers, return all possible permutations.

Example:

Input: [1,2,3]
Output:
[
  [1,2,3],
  [1,3,2],
  [2,1,3],
  [2,3,1],
  [3,1,2],
  [3,2,1]
]
func permute(nums []int) [][]int {
    if len(nums) == 0 {
        return nil
    }

    ans := make([][]int, 0)
    backtrack(nums, nil, &ans)

    return ans
}

func backtrack(nums []int, prev []int, ans *[][]int) {
    if len(nums) == 0 {
        *ans = append(*ans, append([]int{}, prev...))
        return
    }

    for i := 0; i < len(nums); i++ {
        backtrack(append(append([]int{}, nums[0:i]...), nums[i+1:]...),
            append(prev, nums[i]),
            ans)
    }
}

Review

介绍一个 client-server 架构的 crash report & analysis 设计方案。

crash_arch.png

Client 端的 crash reporting 借助于 BreakpadCrashpad 实现。

Breakpad is a set of client and server components which implement a crash-reporting system.

Crashpad is the latest open-source crash reporting tool built by Google. It is the successor to the popular Breakpad crash reporter.

Server 端则是用 Backtrace.io

Tip

  1. To create a FTP server

    docker run -d --name ftpd_server \
        -e FTP_USER_NAME=ftp_user \
        -e FTP_USER_PASS=123456 \
        -e FTP_USER_HOME=/home/ftp_user \
        -e "ADDED_FLAGS=-d -d" \
        -e PUBLICHOST=localhost \
        -p 21:21 -p 30000-30009:30000-30009 stilliard/pure-ftpd:hardened
    
  2. To create a SFTP server

    docker run --name sftp -p 22:22 -d atmoz/sftp ftp_user:passwd:::upload
    

Share

什么才是真正的以客户为中心?🤔🤔

不要成为那只固执的「鸵鸟」

E