TopcoderArchiveVisit Topcoder
SRM28 Dec 2005
SRM 280

UniqueDigits

Problem statement, definition, constraints, and public examples.

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
Back to all problems