Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,27 @@
package main
import (
"log"
"sort"
)
func main() {
log.Println(jortSort([]int{1, 2, 1, 11, 213, 2, 4})) //false
log.Println(jortSort([]int{0, 1, 0, 0, 0, 0})) //false
log.Println(jortSort([]int{1, 2, 4, 11, 22, 22})) //true
log.Println(jortSort([]int{0, 0, 0, 1, 2, 2})) //true
}
func jortSort(a []int) bool {
c := make([]int, len(a))
copy(c, a)
sort.Ints(a)
for k, v := range c {
if v == a[k] {
continue
} else {
return false
}
}
return true
}