Leetcode Note: Go - Smallest Index With Equal Value

Greatest Common Divisor of Strings - LeetCode
https://leetcode.com/problems/greatest-common-divisor-of-strings/

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

回答

Golang solution - Smallest Index With Equal Value - LeetCode
https://leetcode.com/problems/smallest-index-with-equal-value/solutions/1551043/golang-solution/

func smallestEqual(nums []int) int {
    for i := range nums {
        if i % 10 == nums[i] {
            return i
        }
    }
    
    return -1
}