LeetCode
3550. Smallest Index With Digit Sum Equal to Index
For each index i, check whether the digit sum of nums[i] equals i and return the first such index; an honest O(n) linear scan, with a note on why no index above 27 can ever match.
Loading…