Lucky Numbers solution codechef – Chef Believe in Unlucky numbers according to him the numbers like 72,2020,755,834

Lucky Numbers solution codechef

Chef Believe in Unlucky numbers according to him the numbers like 72,2020,755,834 are lucky numbers.And the Numbers like 2,5,11,999,333,7777 are unlucky numbers.

Chef have a number NN from which he wants to calculate total number of lucky numbers that NN contains inside it.

Input: Lucky Numbers solution codechef

  • First line will contain TT, number of testcases. Then the testcases follow.
  • Each testcase contains of a single line of input, An integers NN.

Output: Lucky Numbers solution codechef

For each testcase, output in a single line answer containing the total number of lucky numbers that NN contains inside it.

Constraints

  • 1T10001≤T≤1000
  • 1N1091≤N≤109

Sample Input: Lucky Numbers solution codechef

2
12

100

Sample Output:

2

82

EXPLANATION:

Testcase1:Testcase1: The number 12 contains 2 lucky number inside it i.e 10,12 rest all are unlucky.

Testcase2:Testcase2: The number 100 contains 18 Unlucky numbers inside it that are (1,2,3,4,5,6,7,8,9,11,22,33,44,55,66,77,88,99). rest all are lucky numbers i.e 82

SOLUTION

Click here



Lucky Numbers solution codechef  Splitting a String Into Descending Consecutive Values Minimum Adjacent Swaps to Reach the Kth Smallest Number Minimum Interval to Include Each Query
 

Leave a Comment