re: Daily Coding Puzzles - Nov 4th - Nov 9th VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Friday The Last Word (CodeJam): You are the next contestant on this show, and the host has just showed you the string S. What's the winning last...
 

Go

func Last(w string) (result []string) {
    l := strings.Split(w, "")
    result = []string{l[0]}

    for _, item := range l[1:] {
        if val := result[0]; item > val {
            result = append([]string{item}, strings.Join(result, ""))
        } else {
            result = append(result, item)
        }
    }
    return
}
code of conduct - report abuse