Statistics

Problem Statement for "Dubs"

Problem Statement

A positive integer X is called a double number if its decimal representation (without leading zeroes) has the following properties:

  • it contains at least two digits
  • the two least significant digits are identical

For example, 1488 is a double number, but 3 and 221 are not.


You are given two longs: L and R. Compute how many double numbers lie between L and R, inclusive. Return their count.

Definition

Class:
Dubs
Method:
count
Parameters:
long, long
Returns:
long
Method signature:
long count(long L, long R)
(be sure your method is public)

Constraints

  • L will be between 10 and 1,000,000,000,000 (10^12), inclusive.
  • R will be between L and 1,000,000,000,000 (10^12), inclusive.

Examples

  1. 113464799236

    699002764401

    Returns: 58553796517

    random

  2. 501346554765

    950073613017

    Returns: 44872705826

    random

  3. 48376858957

    220792504052

    Returns: 17241564509

    random

  4. 101337192990

    378858372907

    Returns: 27752117992

    random

  5. 38545321940

    106671028225

    Returns: 6812570629

    random

  6. 124611151838

    239397661677

    Returns: 11478650984

    random

  7. 138547834386

    232307426991

    Returns: 9375959261

    random

  8. 47125899421

    191084480726

    Returns: 14395858131

    random

  9. 82895970282

    175876717732

    Returns: 9298074745

    random

  10. 923003927863

    998207498364

    Returns: 7520357050

    random

  11. 10

    10

    Returns: 0

    The only number in the range [10,10] is 10. It isn't a double number.

  12. 10

    11

    Returns: 1

  13. 11

    11

    Returns: 1

  14. 10

    20

    Returns: 1

    The only double number in the range [10,20] is 11.

  15. 10

    21

    Returns: 1

  16. 49

    101

    Returns: 6

    The double numbers are 55, 66, 77, 88, 99 and 100.

  17. 10

    22

    Returns: 2

  18. 10

    23

    Returns: 2

  19. 11

    21

    Returns: 1

  20. 11

    22

    Returns: 2

  21. 11

    23

    Returns: 2

  22. 12

    21

    Returns: 0

  23. 12

    22

    Returns: 1

  24. 12

    23

    Returns: 1

  25. 1000

    1000000000000

    Returns: 99999999901

  26. 1001

    999999999999

    Returns: 99999999899

  27. 1111111

    111111111

    Returns: 11000001

  28. 22223

    88888888888

    Returns: 8888886666

  29. 50

    100

    Returns: 6

  30. 50

    99

    Returns: 5

  31. 1000000000000

    1000000000000

    Returns: 1

  32. 999999999999

    1000000000000

    Returns: 2

  33. 999999999998

    999999999999

    Returns: 1

  34. 900000001526

    900000002222

    Returns: 70

  35. 47

    53

    Returns: 0

    zero

  36. 826611854162

    826611854164

    Returns: 0

    zero

  37. 888888888883

    888888888883

    Returns: 0

    zero

  38. 688390061801

    688390061810

    Returns: 0

    zero

  39. 10

    1000000000000

    Returns: 100000000000

  40. 12

    999999999998

    Returns: 99999999997

  41. 91750002841

    91751522033

    Returns: 151920

  42. 1000

    1021

    Returns: 2

  43. 34323

    1000000000000

    Returns: 99999996568

  44. 32

    1000000000000

    Returns: 99999999998

  45. 11

    11111111111

    Returns: 1111111111

  46. 99

    99

    Returns: 1

  47. 323

    99999886567

    Returns: 9999988624

  48. 11

    100000000000

    Returns: 10000000000

  49. 10

    1000000000

    Returns: 100000000

  50. 100

    100

    Returns: 1

  51. 1511

    1512

    Returns: 1

  52. 22322

    1000000000000

    Returns: 99999997769

  53. 10

    100000000000

    Returns: 10000000000

  54. 11

    1000000000000

    Returns: 100000000000

  55. 30

    133

    Returns: 11

  56. 100

    101

    Returns: 1


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
This problem was used for: