美文网首页
ARTS 第9周

ARTS 第9周

作者: 陈卧虫 | 来源:发表于2019-06-02 22: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 源码包安装的方式:

  • 找到相应的软件包,eg:soft.tar.gz, 下载到本机某目录
  • 打开终端,sudo -s 切换成root用户,获取最高权限
  • cd到soft.tar.gz所在目录
  • 解压该文件:tar -xzvf soft.tar.gz //一般会生成一个soft目录
  • cd 进入到该文件中:cd soft
  • ./configure 执行预编译
  • make 进行编译
  • make install 安装
  • make clean 删除安装时产生的临时文件

Share

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

  • iota 是一个常量
  • 它的值由所在的行数决定,与在哪一行使用无关(指的是const括号内)
  • 因为iota是常量,所以可以参与任何与数值有关的运算

本周阅读

第五周: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

相关文章

  • 爱画画的你不可错过的九位神级水彩画家

    text/Oh Arts photo/网络 editor/包子 小岛今天入驻了新写手“Oh Arts”,今天她的第...

  • ARTS 第18周

    ARTS 第18周分享 [TOC] Algorithm 56. Merge Intervals [medium] ...

  • ARTS 第10周

    ARTS 第10周分享 [TOC] Algorithm 933. Number of Recent Calls [...

  • ARTS 第1周

    ARTS 第1周分享 Algorithm LeetCode 237 Delete Node in a Linked...

  • ARTS 第21周

    ARTS 第21周分享 [TOC] Algorithm 242. Valid Anagram [easy] [题目...

  • ARTS 第23周

    ARTS 第23周分享 [TOC] Algorithm 349. Intersection of Two Arra...

  • ARTS 第4周

    ARTS 第4周分享 [TOC] Algorithm 1021. Remove Outermost Parenth...

  • ARTS 第19周

    ARTS 第19周分享 [TOC] Algorithm 75. Sort Colors [medium] [题目描...

  • ARTS 第20周

    ARTS 第20周分享 [TOC] Algorithm 164. Maximum Gap [hard] [题目描述...

  • ARTS 第7周

    ARTS 第7周分享 [TOC] Algorithm 922. Sort Array By Parity II 难...

网友评论

      本文标题:ARTS 第9周

      本文链接:https://www.haomeiwen.com/subject/gdufxctx.html