mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
49 lines
1.8 KiB
HTML
49 lines
1.8 KiB
HTML
|
<p>You are given an integer array <code>digits</code>, where each element is a digit. The array may contain duplicates.</p>
|
||
|
|
||
|
<p>You need to find <strong>all</strong> the <strong>unique</strong> integers that follow the given requirements:</p>
|
||
|
|
||
|
<ul>
|
||
|
<li>The integer consists of the <strong>concatenation</strong> of <strong>three</strong> elements from <code>digits</code> in <strong>any</strong> arbitrary order.</li>
|
||
|
<li>The integer does not have <strong>leading zeros</strong>.</li>
|
||
|
<li>The integer is <strong>even</strong>.</li>
|
||
|
</ul>
|
||
|
|
||
|
<p>For example, if the given <code>digits</code> were <code>[1, 2, 3]</code>, integers <code>132</code> and <code>312</code> follow the requirements.</p>
|
||
|
|
||
|
<p>Return <em>a <strong>sorted</strong> array of the unique integers.</em></p>
|
||
|
|
||
|
<p> </p>
|
||
|
<p><strong>Example 1:</strong></p>
|
||
|
|
||
|
<pre>
|
||
|
<strong>Input:</strong> digits = [2,1,3,0]
|
||
|
<strong>Output:</strong> [102,120,130,132,210,230,302,310,312,320]
|
||
|
<strong>Explanation:</strong> All the possible integers that follow the requirements are in the output array.
|
||
|
Notice that there are no <strong>odd</strong> integers or integers with <strong>leading zeros</strong>.
|
||
|
</pre>
|
||
|
|
||
|
<p><strong>Example 2:</strong></p>
|
||
|
|
||
|
<pre>
|
||
|
<strong>Input:</strong> digits = [2,2,8,8,2]
|
||
|
<strong>Output:</strong> [222,228,282,288,822,828,882]
|
||
|
<strong>Explanation:</strong> The same digit can be used as many times as it appears in digits.
|
||
|
In this example, the digit 8 is used twice each time in 288, 828, and 882.
|
||
|
</pre>
|
||
|
|
||
|
<p><strong>Example 3:</strong></p>
|
||
|
|
||
|
<pre>
|
||
|
<strong>Input:</strong> digits = [3,7,5]
|
||
|
<strong>Output:</strong> []
|
||
|
<strong>Explanation:</strong> No <strong>even</strong> integers can be formed using the given digits.
|
||
|
</pre>
|
||
|
|
||
|
<p> </p>
|
||
|
<p><strong>Constraints:</strong></p>
|
||
|
|
||
|
<ul>
|
||
|
<li><code>3 <= digits.length <= 100</code></li>
|
||
|
<li><code>0 <= digits[i] <= 9</code></li>
|
||
|
</ul>
|