Last active
August 29, 2015 14:19
-
-
Save 178inaba/32476ff81b6fd159b367 to your computer and use it in GitHub Desktop.
sort.SearchInts()はSort済みじゃないと動かない ref: http://qiita.com/inaba178/items/795c2e18078c4063a264
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" | |
"sort" | |
) | |
func main() { | |
a := []int{10, 9, 8, 7, 6, 5, 4, 3, 2, 1} | |
res := sort.SearchInts(a, 7) | |
fmt.Println("array:", a) | |
fmt.Println("result:", res) | |
} |
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" | |
"sort" | |
) | |
func main() { | |
a := []int{10, 9, 8, 7, 6, 5, 4, 3, 2, 1} | |
sort.Ints(a) | |
res := sort.SearchInts(a, 7) | |
fmt.Println("array:", a) | |
fmt.Println("result:", res) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment