#3550

Smallest Index With Digit Sum Equal to Index

newbie · 185 · lc easy +15 · 80.1% accepted · 68 likes · top 92%

Description

Given integer array nums, find the smallest index i where the digit sum of nums[i] equals i.

Return that index, or -1 if no such index exists.

Code

1
2
3