Leetcode Note: Go - Maximum 69 Number

Maximum 69 Number - LeetCode
https://leetcode.com/problems/maximum-69-number/

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

回答

[Go/Golang] Simple 2 line solution with strings.Replace (100% Runtime/100% Memory) - Maximum 69 Number - LeetCode
https://leetcode.com/problems/maximum-69-number/solutions/486969/go-golang-simple-2-line-solution-with-strings-replace-100-runtime-100-memory/

func maximum69Number (num int) int {
    r, _ := strconv.Atoi((strings.Replace(strconv.Itoa(num), "6", "9", 1)))
    return r
}