โ† Drishti-Soft Solutions questions

Count how many times the digit 2 appears between 1 and n

Filed under Drishti-Soft Solutions

The question

Given a number n, count the occurrences of the digit 2 across all numbers from 1 to n. For n=19 the numbers 2 and 12 give 2.

No write-up yet. Related questions below have one.

Related Drishti-Soft Solutions questions

Collected from public candidate posts and coding forums. Updated Nov 2026.