This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
type data struct { | |
i int | |
s string | |
} | |
func (d data) String() string { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func firstNonRepeatChar(s string) rune { | |
useMap := make(map[rune]bool) | |
for _, v := range s { | |
_, ok := useMap[v] | |
useMap[v] = ok | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"os" | |
"strconv" | |
"time" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
type ValSet struct { | |
one, two, three, four *int | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
type fber func(int)string | |
func fizzer(i int) string { | |
return "fizz" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
//based on code from http://www.arcfn.com/2009/03/y-combinator-in-arc-and-java.html | |
type Func func (interface{}) interface{} | |
type FuncToFunc func (Func) Func |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
import "math/rand" | |
import "time" | |
func main() { | |
rand.Seed(time.Now().UnixNano()) | |
vals := rand.Perm(10) | |
fmt.Println(vals) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math/rand" | |
) | |
/* | |
A famous problem of computer science is the knapsack problem, in which you are to find a combination of items from a population that sums to a given target, | |
often with some kind of constraint such as maximizing the value of the items. In today’s problem we want to find the first possible combination |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
type FSlice []interface{} | |
type Collector func(interface{}) interface{} | |
type Reducer func(*interface{}, interface{}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ 36.904] | |
X.Org X Server 1.14.3 | |
Release Date: 2013-09-12 | |
[ 36.904] X Protocol Version 11, Revision 0 | |
[ 36.905] Build Operating System: Linux 3.2.0-37-generic x86_64 Ubuntu | |
[ 36.905] Current Operating System: Linux localhost 3.8.11 #1 SMP Tue Dec 17 23:30:18 PST 2013 x86_64 | |
[ 36.905] Kernel command line: cros_secure console= loglevel=7 init=/sbin/init cros_secure oops=panic panic=-1 root=/dev/dm-0 rootwait ro dm_verity.error_behavior=3 dm_verity.max_bios=-1 dm_verity.dev_wait=1 dm="1 vroot none ro 1,0 2097152 verity payload=PARTUUID=2c4281de-eb40-5845-b5d3-3abb5bec426c/PARTNROFF=1 hashtree=PARTUUID=2c4281de-eb40-5845-b5d3-3abb5bec426c/PARTNROFF=1 hashstart=2097152 alg=sha1 root_hexdigest=026a06e3907ed6c5d49c5fc171be6f96c9d4748f salt=f1eaf5d4d293e159349aed39e38e6965934873a4409313af98a350450a7ec894" noinitrd vt.global_cursor_default=0 kern_guid=2c4281de-eb40-5845-b5d3-3abb5bec426c add_efi_memmap boot=local noresume noswap i915.modeset=1 tpm_tis.force=1 tpm_tis.interrupts=0 nmi_watchdog=panic,lapi |
OlderNewer