Search
⌘K

Leetcode 3550. Smallest Index With Digit Sum Equal to Index

Find the smallest index i in nums such that the sum of the decimal digits of nums[i] equals i, or return -1 if no such index exists. With n ≤ 100 and nums[i] ≤ 1000, a simple linear scan computing digit sums suffices.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.