Statistics

Problem Statement for "UniqueDigits"

Problem Statement

Given an int n find all positive integers less than n whose digits are all different. Return the total number of such integers.

Definition

Class:
UniqueDigits
Method:
count
Parameters:
int
Returns:
int
Method signature:
int count(int n)
(be sure your method is public)

Constraints

  • n will be between 1 and 10000 inclusive.

Examples

  1. 21

    Returns: 19

    We count all integers between 1 and 20, except 11.

  2. 101

    Returns: 90

  3. 1001

    Returns: 738

  4. 1

    Returns: 0

  5. 2

    Returns: 1

  6. 10000

    Returns: 5274

  7. 62

    Returns: 56

  8. 3090

    Returns: 1795

  9. 6795

    Returns: 3648

  10. 7358

    Returns: 3963

  11. 2314

    Returns: 1362

  12. 995

    Returns: 738

  13. 6526

    Returns: 3556

  14. 1408

    Returns: 911

  15. 877

    Returns: 657

  16. 7560

    Returns: 4077

  17. 3969

    Returns: 2236

  18. 6685

    Returns: 3594

  19. 1871

    Returns: 1173

  20. 9387

    Returns: 4993

  21. 4531

    Returns: 2496

  22. 10000

    Returns: 5274

  23. 5000

    Returns: 2754

  24. 9000

    Returns: 4770


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: