Leetcode Note: Go - Shuffle String

Shuffle String - LeetCode
https://leetcode.com/problems/shuffle-string/

  • Go 言語で取り組んだメモ

回答

Solutions in multiple languages (Java C++ Golang Python Kotlin PHP) - Shuffle String - LeetCode
https://leetcode.com/problems/shuffle-string/solutions/763747/solutions-in-multiple-languages-java-c-golang-python-kotlin-php/

func restoreString(s string, indices []int) string {
    l := len(s);
    res := make([]byte, l)
    for i := 0; i < l; i++ {
        res[indices[i]] = s[i]
    }
    return string(res)
}