#3550

Smallest Index With Digit Sum Equal to Index

easy · 80.1% accepted · 68 likes · top 92%

array · math

Description

You are given an integer array nums.

Return the smallest index i such that the sum of the digits of nums[i] is equal to i.

If no such index exists, return -1.

Solution