- 博客(16)
- 收藏
- 关注
原创 GO学习第七天(duck typing、接口组合)
duck typing是不是真正的鸭子接口组合type Retriever interface { Get(url string) string}type Poster interface { Post(url string, form map[string]string) string}type session interface { Poster Retrie...
2019-05-30 21:17:31 126
原创 GO学习第六天(面对对象、包)
包为结构定义的方法必须放在包内可以是不同文件组合type myNode struct { node *tree.Node}func (node *myNode) after() { if node == nil || node.node == nil { return } left := myNode{node.node.Left} right := myNode{...
2019-05-29 17:41:13 79
原创 LeetCode - 3无重复字符的最长子串
题目给定一个字符串,请你找出其中不含有重复字符的 最长子串 的长度。示例 1:输入: “abcabcbb”输出: 3解释: 因为无重复字符的最长子串是 “abc”,所以其长度为 3。示例 2:输入: “bbbbb”输出: 1解释: 因为无重复字符的最长子串是 “b”,所以其长度为 1。示例 3:输入: “pwwkew”输出: 3解释: 因为无重复字符的最长子串是 “wke...
2019-05-28 23:53:57 91
原创 LeetCode -1两数之和
题目给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标。你可以假设每种输入只会对应一个答案。但是,你不能重复利用这个数组中同样的元素。示例:给定 nums = [2, 7, 11, 15], target = 9因为 nums[0] + nums[1] = 2 + 7 = 9所以返回 [0, 1]func two...
2019-05-28 23:51:42 88
原创 GO学习第五天(结构体)
结构体创建type treeNode struct { value int left, right *treeNode}func main() { var tree treeNode fmt.Println(tree) tree = treeNode{5, nil, nil} tree.left = &treeNode{} tree.right = &...
2019-05-28 23:49:47 111
原创 GO学习第四天(切片操作、map、rune)
切片的append操作 arr := [...]int{0, 1, 2, 3, 4, 5, 6} s1 := arr[2:5] s3 := append(s1, 10) s4 := append(s3, 20) // 超过arr的cap 系统会重新分配更大数组 // s5 no longer view arr s5 := append(s4, 30) fmt.Println("s3...
2019-05-27 22:47:51 474
原创 Subsequence ZOJ:3123
SubsequenceTime Limit:1 Second Memory Limit:32768 KBA sequence ofNpositive integers(10 < N < 100 000), each of them less than or equal10000, and a positive integerS (S < 100 0...
2019-05-27 10:40:37 108
原创 Gene Assembly ZOJ:1076
Gene AssemblyTime Limit:2 Seconds Memory Limit:65536 KBStatement of the ProblemWith the large amount of genomic DNA sequence data being made available, it is becoming more important to fi...
2019-05-27 10:32:03 131
原创 FatMouse' Trade ZOJ:2109
FatMouse' TradeTime Limit:2 Seconds Memory Limit:65536 KBFatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBean....
2019-05-27 10:29:45 93
原创 GO学习第三天(切片)
指针func swap(a, b *int) { *a, *b = *b, *a}函数只有值传递,没有引用交换值func main() { a, b := 3, 4 a, b = swap(a, b) fmt.Println(a, b)}func swap(a, b int) (int,int){ return b,a}数组定义func main() { va...
2019-05-26 23:33:55 95
原创 GO学习第二天(数组)
数字转字符串strconv.Itoa(n%2)一行行读文件func printFile () { file, err := os.Open("./learn/abc.txt") if err!=nil { panic(err) } scanner := bufio.NewScanner(file) for scanner.Scan() { fmt.Println(sca...
2019-05-26 00:17:24 92
原创 GO学习第一天(基本语法)
1.读文件const filename = "./learn/abc.txt"if value, err := ioutil.ReadFile(filename); err != nil { fmt.Println(err)} else { fmt.Printf("%s\n", value)}2.switchfunc grade(score int) string {...
2019-05-24 13:44:11 157
原创 vue项目热更新坑
今天在使用vue-cli构造的vue项目时,遇到一个坑。setInterval(() => { console.log('This is one.')}, 10000)运行后如下:这时我们修改其中的代码,不刷新网页:setInterval(() => { console.log('This is two.')}, 1000) 结果如下,发现之前...
2019-05-20 14:31:25 4159 1
原创 Vue学习开发总结
总结在近段时间使用Vue开发时遇到的问题及知识点。Vue.config.silent日志警告,在开发环境默认为true,生成生产环境默认为falsev-pre可以跳跃编译,加快编译速度v-cloak用来保持在元素上直到关联实例结束时进行编译。可以 隐藏未编译的Mustache标签,解决加载时页面闪烁问题。[v-cloak] { display:none;}v-on...
2019-05-11 13:12:24 209
原创 js扁平化数组
使用apply,可以将任意维度数组降为一维数组。[].concat.apply([],arr)使用es6扩展运算符...,但是只能降阶一层。[].concat(...arr)
2019-05-04 22:52:19 231
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人