Connection Status:
Competition Arena > UniqueDigits
SRM 280 · 2005-12-28 · by dimkadimon · Brute Force
Class Name: UniqueDigits
Return Type: int
Method Name: count
Arg Types: (int)
Problem Statement

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.

Constraints

  • n will be between 1 and 10000 inclusive.
Examples
0)
21
Returns: 19

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

1)
101
Returns: 90
2)
1001
Returns: 738
3)
1
Returns: 0
4)
2
Returns: 1

Submissions are judged against all 24 archived test cases, of which 5 are shown here. Case numbers match the judge’s.

Coding Area

Language: C++17 · define a public class UniqueDigits with a public method int count(int n) · 24 test cases · 2 s / 256 MB per case

Submitting as anonymous