Count distinct three-digit even integers from available digit copies. Enforce nonzero leading digits and per-number multiplicities without double-counting identical integer values.
### Problem
You are given an array `digits` containing decimal digits. Return the number of distinct three-digit even integers that can be formed from the available digit copies.
A number cannot start with zero. Within one number, each array element can be used at most once. Equal digit values may be used several times only when the array contains enough separate copies. The same digit copies may be used again when considering a different number.
### C++ Interface
```cpp
class Solution {
public:
int totalNumbers(vector<int>& digits) {
}
};
```
### Examples
**Example 1**
```text
Input: digits = [0,1,2]
Output: 3
```
The possible numbers are `102`, `120`, and `210`. Arrangements beginning with zero are not three-digit numbers, and arrangements ending in `1` are odd.
**Example 2**
```text
Input: digits = [0,0,2,4]
Output: 6
```
The possible numbers are `200`, `204`, `240`, `400`, `402`, and `420`. The two zero copies permit `200` and `400`; different selections of identical zero copies do not create additional distinct numbers.
### Constraints
- `3 <= digits.length <= 10`.
- `0 <= digits[i] <= 9`.
### Clarifying Questions
- Must every digit in the array be used? No. Each number uses exactly three available copies.
- Are two numbers different because they use different copies of the same digit value? No. Distinctness depends only on the resulting integer.
- May a number end in zero? Yes. Zero is an even digit; it is only forbidden in the hundreds position.
### What a Strong Answer Covers
- The three-digit, evenness, and no-leading-zero requirements.
- Separate digit-copy limits within each number.
- Counting each resulting integer once despite repeated input values.
- Cases with no usable even number, several zeros, or repeated digits.
### Follow-up Questions
- How would the count change if leading zero were allowed and the result were a three-character code instead of an integer?
- What would change if digit copies had to be consumed across all the numbers rather than reused for each candidate number?
```hint A small candidate space
There are only 450 three-digit even integers. For each one, compare how many copies of each digit it needs with how many the input supplies.
```
Overview: Count distinct three-digit even integers from available digit copies. Enforce nonzero leading digits and per-number multiplicities without double-counting identical integer values.
You are given an array digits containing decimal digits. Return the number of distinct three-digit even integers that can be formed from the available digit copies.
A number cannot start with zero. Within one number, each array element can be used at most once. Equal digit values may be used several times only when the array contains enough separate copies. The same digit copies may be used again when considering a different number.
C++ Interface
class Solution {
public:
int totalNumbers(vector<int>& digits) {
}
};
Examples
Example 1
Input: digits = [0,1,2]
Output: 3
The possible numbers are 102, 120, and 210. Arrangements beginning with zero are not three-digit numbers, and arrangements ending in 1 are odd.
Example 2
Input: digits = [0,0,2,4]
Output: 6
The possible numbers are 200, 204, 240, 400, 402, and 420. The two zero copies permit 200 and 400; different selections of identical zero copies do not create additional distinct numbers.
Constraints
3 <= digits.length <= 10
.
0 <= digits[i] <= 9
.
Clarifying Questions Guidance
Must every digit in the array be used? No. Each number uses exactly three available copies.
Are two numbers different because they use different copies of the same digit value? No. Distinctness depends only on the resulting integer.
May a number end in zero? Yes. Zero is an even digit; it is only forbidden in the hundreds position.
What a Strong Answer Covers Guidance
The three-digit, evenness, and no-leading-zero requirements.
Separate digit-copy limits within each number.
Counting each resulting integer once despite repeated input values.
Cases with no usable even number, several zeros, or repeated digits.
Follow-up Questions Guidance
How would the count change if leading zero were allowed and the result were a three-character code instead of an integer?
What would change if digit copies had to be consumed across all the numbers rather than reused for each candidate number?