ARTS 第9周

栏目: Go · 发布时间: 6年前

内容简介:[TOC][思路]

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

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Eloquent JavaScript

Eloquent JavaScript

Marijn Haverbeke / No Starch Press / 2011-2-3 / USD 29.95

Eloquent JavaScript is a guide to JavaScript that focuses on good programming techniques rather than offering a mish-mash of cut-and-paste effects. The author teaches you how to leverage JavaScript's......一起来看看 《Eloquent JavaScript》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

MD5 加密
MD5 加密

MD5 加密工具

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具