Skip to content

Instantly share code, notes, and snippets.

@sunho
Created January 15, 2018 22:31
Show Gist options
  • Save sunho/8be2714833e77c2e1b794c83c9805e03 to your computer and use it in GitHub Desktop.
Save sunho/8be2714833e77c2e1b794c83c9805e03 to your computer and use it in GitHub Desktop.
type Sequence []int
// Methods required by sort.Interface.
func (s Sequence) Len() int {
return len(s)
}
func (s Sequence) Less(i, j int) bool {
return s[i] < s[j]
}
func (s Sequence) Swap(i, j int) {
s[i], s[j] = s[j], s[i]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment