package mainimport ( "fmt" "sync")var wg
sync.WaitGroupfunc asyncTestFunc() { for i := 0; i < 100; i++ {
fmt.Println(i) } wg.Don...
分类:
其他好文 时间:
2014-05-10 05:35:55
阅读次数:
286
来源:http://poj.org/problem?id=2406
Power Strings
Time Limit: 3000MS
Memory Limit: 65536K
Total Submissions: 30293
Accepted: 12631
Description
Given two strin...
分类:
其他好文 时间:
2014-05-08 02:03:40
阅读次数:
337
strings="1234567";stringlast6chars=newstring(s.Reverse().Take(6).Reverse().ToArray());//先反转顺序,从开头截取指定数量的字符,再反转顺序
分类:
其他好文 时间:
2014-05-07 19:08:09
阅读次数:
292
【题目】
Chapter 1 | Arrays and Strings
原文:
1.1 Implement an algorithm to determine if a string has all unique characters. What if you can not use additional data structures?
译文:
实现一个算法来判断一个字符串中的字符...
分类:
其他好文 时间:
2014-05-07 04:27:41
阅读次数:
312
CareerCup
目录
Chapter 1 | Arrays and Strings
1.1 Implement an algorithm to determine if a string has all unique characters. What if you can not use additional data structures?
1.2 Write co...
分类:
其他好文 时间:
2014-05-07 04:25:44
阅读次数:
320
Golang开发环境搭建 Notepad++、LiteIDE两种方式
martini框架的使用...
分类:
其他好文 时间:
2014-05-07 03:02:54
阅读次数:
289
【题目】
原文:
1.4 Write a method to decide if two strings are anagrams or not.
译文:
写一个函数判断两个字符串是否是变位词。
【分析】
变位词(anagrams)指的是组成两个单词的字符相同,但位置不同的单词。比如说, abbcd和abcdb就是一对变位词。该题目有两种思路:
【思路一】
由于变位词只是字...
分类:
其他好文 时间:
2014-05-06 23:17:56
阅读次数:
383
前一篇文章我们看到了Golang标准库中log模块的使用,那么它是如何实现的呢?下面我从log.Logger开始逐步分析其实现。其源码可以参考官方地址1.Logger结构首先来看下类型Logger的定义:typeLoggerstruct{
musync.Mutex//ensuresatomicwrites;protectsthefollowingfields
prefixs..
分类:
其他好文 时间:
2014-05-06 17:10:28
阅读次数:
1024
Golang的标准库提供了log的机制,但是该模块的功能较为简单(看似简单,其实他有他的设计思路)。不过比手写fmt.Printxxx还是强很多的。至少在输出的位置做了线程安全的保护。其官方手册见Golanglog(天朝的墙大家懂的)。这里给出一个简单使用的例子:packagemain
import(
"log"..
分类:
其他好文 时间:
2014-05-05 12:22:27
阅读次数:
20583
ArraysArrays are zero-indexed, ordered lists of
values. They are a handy way to store a set of related items of the same type
(such as strings), thoug...
分类:
编程语言 时间:
2014-05-04 19:08:29
阅读次数:
533