I have a Go Language question here, is there any much better way to answer the answer in coding Golang compare to mine below?
Mangkuk is a list consisting of maximal size Sudu. Sudu is a permutation of consecutive integers, possibly with repeated items.
A Cawan is a Mangkuk where each Sudu is sorted in the ascending order. Write a function, MakeCawan(→Mangkuk), to sort the given Mangkuk into a Cawan.
For example,
MakeCawan([21, 20, 18, 20, 18, 20, 19]),
MakeCawan([21, 2000000, 18, 20, 18, 20, 19]),
MakeCawan([21, 20, 18, 20, 18, 20, 1900000])
should produce, respectively,
[18, 18, 19, 20, 20, 20, 21],
[21, 2000000, 18, 18, 19, 20, 20],
[20, 21, 18, 20, 18, 20, 1900000].
package main
import (
"fmt"
"sort"
)
func main() {
sl := []string{"MakeCawan"}
sort.Sort(sort.StringSlice(sl))
fmt.Println(sl)
sl1 := []string{"MakeCawan"}
sort.Sort(sort.StringSlice(sl1))
fmt.Println(sl1)
sl2 := []string{"MakeCawan"}
sort.Sort(sort.StringSlice(sl2))
fmt.Println(sl2)
intSlice := []int{21,20,18,20,18,20,19}
sort.Sort(sort.IntSlice(intSlice))
fmt.Println(intSlice)
}
The Output:
https://play.golang.org/p/tsE0BtMRos_9
</div>