Skip to content

Latest commit

 

History

History
17 lines (11 loc) · 491 Bytes

File metadata and controls

17 lines (11 loc) · 491 Bytes

numberOfOnes

Interview question of the issue #259 of rendezvous with cassidoo.

The Question

Given an integer n, count the total number of 1 digits appearing in all non-negative integers less than or equal to n.

Example:

> numberOfOnes(14)
> 7 // 1, 10, 11, 12, 13, 14

Installing & Running

Just pnpm i to install all dependencies and then pnpm t to run the tests!