Skip to content

chasestarr/inversion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

GoDoc

import (
  "fmt"

  "github.com/chasestarr/inversion"
)

func main() {
  count := inversion.Count([]int{6, 5, 4, 3, 2, 1})
  fmt.Println(count) // 15
  // # of inversions in reversed array are: (n(n-1))/2
}

About

Inversion.Count returns the number of inversions in an integer array

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages