You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

20 lines
322 B

package solutions
func CompArray(a, b string) int {
if a < b {
return -1
}
if a > b {
return 1
}
return 0
}
func AdvancedSortWordArr(array []string, f func(a, b string) int) {
for i := 1; i < len(array); i++ {
if f(array[i], array[i-1]) < 0 {
array[i], array[i-1] = array[i-1], array[i]
i = 0
}
}
}