|
| 1 | +<p>You are given an integer array <code>digits</code>, where each element is a digit. The array may contain duplicates.</p> |
| 2 | + |
| 3 | +<p>You need to find <strong>all</strong> the <strong>unique</strong> integers that follow the given requirements:</p> |
| 4 | + |
| 5 | +<ul> |
| 6 | + <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> |
| 7 | + <li>The integer does not have <strong>leading zeros</strong>.</li> |
| 8 | + <li>The integer is <strong>even</strong>.</li> |
| 9 | +</ul> |
| 10 | + |
| 11 | +<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> |
| 12 | + |
| 13 | +<p>Return <em>a <strong>sorted</strong> array of the unique integers.</em></p> |
| 14 | + |
| 15 | +<p> </p> |
| 16 | +<p><strong class="example">Example 1:</strong></p> |
| 17 | + |
| 18 | +<pre> |
| 19 | +<strong>Input:</strong> digits = [2,1,3,0] |
| 20 | +<strong>Output:</strong> [102,120,130,132,210,230,302,310,312,320] |
| 21 | +<strong>Explanation:</strong> All the possible integers that follow the requirements are in the output array. |
| 22 | +Notice that there are no <strong>odd</strong> integers or integers with <strong>leading zeros</strong>. |
| 23 | +</pre> |
| 24 | + |
| 25 | +<p><strong class="example">Example 2:</strong></p> |
| 26 | + |
| 27 | +<pre> |
| 28 | +<strong>Input:</strong> digits = [2,2,8,8,2] |
| 29 | +<strong>Output:</strong> [222,228,282,288,822,828,882] |
| 30 | +<strong>Explanation:</strong> The same digit can be used as many times as it appears in digits. |
| 31 | +In this example, the digit 8 is used twice each time in 288, 828, and 882. |
| 32 | +</pre> |
| 33 | + |
| 34 | +<p><strong class="example">Example 3:</strong></p> |
| 35 | + |
| 36 | +<pre> |
| 37 | +<strong>Input:</strong> digits = [3,7,5] |
| 38 | +<strong>Output:</strong> [] |
| 39 | +<strong>Explanation:</strong> No <strong>even</strong> integers can be formed using the given digits. |
| 40 | +</pre> |
| 41 | + |
| 42 | +<p> </p> |
| 43 | +<p><strong>Constraints:</strong></p> |
| 44 | + |
| 45 | +<ul> |
| 46 | + <li><code>3 <= digits.length <= 100</code></li> |
| 47 | + <li><code>0 <= digits[i] <= 9</code></li> |
| 48 | +</ul> |
0 commit comments