Finding Commas

Company: nagarro_18aug

Difficulty: medium

Problem Statement

Finding Commas Problem Description Liam works as a data analyst for a company that stores massive amounts of numerical data. He has been tasked with determining how many commas are used when writing the numbers in the range 1 to N (inclusive) in a specific format. In this format, commas separate the digits of a number into groups of three, starting from the right. A number with four or more digits therefore contains at least one comma: 1000 is written as 1,000 , 100000 as 100,000 and 1000000 as 1,000,000 . A number with at most three digits contains no comma. (Correction -- the source text says "more than four digits", but its own Example 1 writes 1000 as 1,000 and counts that comma, and its Example 2 explanation says numbers with fewer than four digits use no comma. Only the "four or more digits" reading reproduces the output 11 .) Complete the function findCommas(input1) , where input1 is the integer N . It returns the total number of commas used when writing every integer from 1 to