|
9 | 9 |
|
10 | 10 | <!-- problem:start -->
|
11 | 11 |
|
12 |
| -# [3437. Permutations III 🔒](https://leetcode.cn/problems/permutations-iii) |
| 12 | +# [3437. 全排列 III 🔒](https://leetcode.cn/problems/permutations-iii) |
13 | 13 |
|
14 | 14 | [English Version](/solution/3400-3499/3437.Permutations%20III/README_EN.md)
|
15 | 15 |
|
16 | 16 | ## 题目描述
|
17 | 17 |
|
18 | 18 | <!-- description:start -->
|
19 | 19 |
|
20 |
| -<p>Given an integer <code>n</code>, an <strong>alternating permutation</strong> is a permutation of the first <code>n</code> positive integers such that no <strong>two</strong> adjacent elements are <strong>both</strong> odd or <strong>both</strong> even.</p> |
| 20 | +<p>给定一个整数 <code>n</code>,一个 <strong>交替排列</strong> 是没有 <strong>两个</strong> 相邻元素 <strong>同时</strong> 为奇数或偶数的前 <code>n</code> 个正整数的排列。</p> |
21 | 21 |
|
22 |
| -<p>Return <em>all such </em><strong>alternating permutations</strong> sorted in lexicographical order.</p> |
| 22 | +<p>返回所有这样的 <strong>交替排列</strong> 以字典序排序。</p> |
23 | 23 |
|
24 | 24 | <p> </p>
|
25 |
| -<p><strong class="example">Example 1:</strong></p> |
| 25 | + |
| 26 | +<p><strong class="example">示例 1:</strong></p> |
26 | 27 |
|
27 | 28 | <div class="example-block">
|
28 |
| -<p><strong>Input:</strong> <span class="example-io">n = 4</span></p> |
| 29 | +<p><span class="example-io"><b>输入:</b>n = 4</span></p> |
29 | 30 |
|
30 |
| -<p><strong>Output:</strong> <span class="example-io">[[1,2,3,4],[1,4,3,2],[2,1,4,3],[2,3,4,1],[3,2,1,4],[3,4,1,2],[4,1,2,3],[4,3,2,1]]</span></p> |
| 31 | +<p><span class="example-io"><b>输出:</b>[[1,2,3,4],[1,4,3,2],[2,1,4,3],[2,3,4,1],[3,2,1,4],[3,4,1,2],[4,1,2,3],[4,3,2,1]]</span></p> |
31 | 32 | </div>
|
32 | 33 |
|
33 |
| -<p><strong class="example">Example 2:</strong></p> |
| 34 | +<p><strong class="example">示例 2:</strong></p> |
34 | 35 |
|
35 | 36 | <div class="example-block">
|
36 |
| -<p><strong>Input:</strong> <span class="example-io">n = 2</span></p> |
| 37 | +<p><span class="example-io"><b>输入:</b>n = 2</span></p> |
37 | 38 |
|
38 |
| -<p><strong>Output:</strong> <span class="example-io">[[1,2],[2,1]]</span></p> |
| 39 | +<p><span class="example-io"><b>输出:</b>[[1,2],[2,1]]</span></p> |
39 | 40 | </div>
|
40 | 41 |
|
41 |
| -<p><strong class="example">Example 3:</strong></p> |
| 42 | +<p><strong class="example">示例 3:</strong></p> |
42 | 43 |
|
43 | 44 | <div class="example-block">
|
44 |
| -<p><strong>Input:</strong> <span class="example-io">n = 3</span></p> |
| 45 | +<p><strong>输入:</strong><span class="example-io">n = 3</span></p> |
45 | 46 |
|
46 |
| -<p><strong>Output:</strong> <span class="example-io">[[1,2,3],[3,2,1]]</span></p> |
| 47 | +<p><span class="example-io"><b>输出:</b>[[1,2,3],[3,2,1]]</span></p> |
47 | 48 | </div>
|
48 | 49 |
|
49 | 50 | <p> </p>
|
50 |
| -<p><strong>Constraints:</strong></p> |
| 51 | + |
| 52 | +<p><strong>提示:</strong></p> |
51 | 53 |
|
52 | 54 | <ul>
|
53 | 55 | <li><code>1 <= n <= 10</code></li>
|
|
0 commit comments