Trying to sort numbers as strings!?

Report a typo

Lena is a very curious programmer. She has decided to create a program with a slice of strings numbers and apply the sort.Strings() function on it to see how the sorting algorithm would work when sorting string numbers:

package main

import (
    "fmt"
    "sort"
)

func main() {
    numbers := []string{"42", "343", "777", "1024"}

    sort.Strings(numbers)

    fmt.Println(numbers)
}

Please order the numbers below in the same order (from top to bottom) that they will have after using the sort.Strings() function on them!

Tip: If you are stuck, you might try running the code and checking the output in the Go playground.

Put the items in the correct order
1024
42
343
777
___

Create a free account to access the full topic