ARTS 第9周

2019-06-02  本文已影响0人  陈卧虫

ARTS 第9周分享

[TOC]

Algorithm

682. 棒球比赛

[思路]

  1. 用一个栈来存储所有的分数即可

[参考代码]

func baseballGame(ops []string) int {
    intSlice := make([]int, 2)
    sum := 0
    for _, v := range ops {
        switch {
        case v == "+":
            lens := len(intSlice)
            vInt := intSlice[lens-1] + intSlice[lens-2]
            sum += vInt
            intSlice = append(intSlice, vInt)
        case v == "D":
            lens := len(intSlice)
            vInt := intSlice[lens-1]*2
            sum += vInt
            intSlice = append(intSlice, vInt)
        case v == "C":
            lens := len(intSlice)
            vInt := intSlice[lens-1]
            sum -= vInt
            intSlice = intSlice[:lens-1]
        default:
            vInt, _ := strconv.Atoi(v)
            sum += vInt
            intSlice = append(intSlice, vInt)
        }
    }
    return sum
}

Review

Tips

本周因为要在mac上安装ffmpeg, 在它的官网上下载了安装包,结果是tar.gz格式的,

这个之前没有安装过,所以了解了一番,做个总结:

tar.gz 源码包安装的方式:

Share

iota: Golang 中优雅的常量: https://segmentfault.com/a/1190000000656284

本周阅读

第五周:1,  2, 3, 7

Mac OS X编译ffmpeg: https://www.liaoxuefeng.com/article/895920078059968
Mac 配置FFmpeg环境: https://www.jianshu.com/p/627b2d462151
linux下configure,make,make install的意义: https://blog.51cto.com/bigdoudou/297605
./configure,make,make install的作用: https://www.linuxidc.com/Linux/2011-02/32211.htm
make和make install的区别: https://zhidao.baidu.com/question/1609799056285524187.html

什么是编译与反编译: https://mp.weixin.qq.com/s/_Qf51t5zXgqM2ZC-HUGBYw
iota: Golang 中优雅的常量: https://segmentfault.com/a/1190000000656284

6 个休息小技巧: https://mp.weixin.qq.com/s/Awqeuhs9PQw4UxpmE2gMag

- 

-

-

golang进程池: https://golangbot.com/buffered-channels-worker-pools/
go语言标准库sync/atomic中的原子操作:https://www.jianshu.com/p/bbdbc1c80137
linux安装软件的几种方法:https://blog.csdn.net/m0_37327416/article/details/78779532
上一篇 下一篇

猜你喜欢

热点阅读