Skip to content

Practice Smallest Index With Equal Value

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#2057
LeetCode Problem

Smallest Index With Equal Value

Problem Statement

Given a 0-indexed integer array nums, return the smallest index i of nums such that i mod 10 == nums[i], or -1 if such index does not exist. x mod y denotes the remainder when x is divided by y.

Source: Smallest Index With Equal Value on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [0,1,2]
Output
0

# Example 2

Input
nums = [4,3,2,1]
Output
2

# Example 3

Input
nums = [1,2,3,4,5,6,7,8,9,0]
Output
-1

Constraints

1 <= nums.length <= 100
0 <= nums[i] <= 9

Related LeetCode Problems

Practice more problems similar to Smallest Index With Equal Value.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.