Powerful Numbers

1

2 votes
Mathematics, Medium, Mathematics, Mathamatics
Problem

You are given two numbers L and R. You have to find the count of powerful numbers that are present in the range [L,R].
Note: A powerful number is a valid number that contains at least three distinct digits.

Input format

  • First line: T denoting the number of test cases

For each test case:

  • First line: Two space-separated integers L  and R

Output format

  • For each test case, print the answer in a separate line.

Constraints
1T100
0LR109

 

Time Limit: 2
Memory Limit: 256
Source Limit:
Explanation

For the range [100,110] all powerful numbers are :- 102,103,104,105,106,107,108,109 .
Hence answer is 8.

Editor Image

?