4
Reply

to count number of 2's from 0 to 35

Shridhar Sharma

Shridhar Sharma

Apr 7 2014 7:04 AM
897
Write a method to count the number of 2's between 0 and n.
EXAMPLE:
input: 35
output: 14 [list of 2's: 2, 12, 20, 21, 22, 23, 24, 25, 26, 27,28, 29, 32]

Answers (4)