All submissions for this problem are available.
A number X is called Permut number if X and 2X ( both without leading zeroes ) have same number of digits and are permutations of each other. Given A and B, find the number of Permut numbers >= A and <= B.
Note : X is called permutation of Y if every digit ( 0 - 9 ) occurs same number of times in both the numbers ( maybe at different positions ).
The first line contains the number of test cases T. T lines follow, containing two integers A and B.
Output T lines, one for each test case containing the desired answer for the corresponding test case.
Sample Input : 2 1 100 499875921 499875921
Sample Output : 0 1
Constraints : 1 <= T <= 10000 1 <= A <= B <= 10000000000 (10^10)
|Tags||hard, july10, syco|
|Time Limit:||0.153836 sec|
|Source Limit:||5000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.5, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, kotlin, PERL6, TEXT, SCM chicken, CLOJ, COB, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.