Skip to content

slice.ReverseString(m) 是反转吧,并不是倒序排 #1

@liuhengbo

Description

@liuhengbo
func ReverseString(s []string) {
	for from, to := 0, len(s)-1; from < to; from, to = from+1, to-1 {
		s[from], s[to] = s[to], s[from]
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions