提交 a73ff9b0 编写于 作者: F feilong

edit exe

上级 ef4af1a4
......@@ -47,18 +47,13 @@
<strong>解释:</strong>
该算式转化为常见的中缀算术表达式为:
((10 * (6 / ((9 + 3) * -11))) + 17) + 5
((10 * (6 / ((9 + 3) * -11))) + 17) + 5
= ((10 * (6 / (12 * -11))) + 17) + 5
= ((10 * (6 / -132)) + 17) + 5
= ((10 * 0) + 17) + 5
= (0 + 17) + 5
= 17 + 5
= 22</pre>
<p> </p>
......
......@@ -12,13 +12,9 @@
<strong>输出:</strong><code>[2,1,1,0]
<strong>解释:</strong></code>
5 的右侧有 <strong>2 </strong>个更小的元素 (2 和 1)
2 的右侧仅有 <strong>1 </strong>个更小的元素 (1)
6 的右侧有 <strong>1 </strong>个更小的元素 (1)
1 的右侧有 <strong>0 </strong>个更小的元素
</pre>
......
......@@ -6,7 +6,7 @@
给定二叉树 <code>[3,9,20,null,null,15,7]</code>,</p>
<pre>
```
3
/ \
......@@ -16,11 +16,11 @@
/ \
15 7
</pre>
```
<p>返回锯齿形层序遍历如下:</p>
<pre>
```
[
[3],
......@@ -30,7 +30,7 @@
[15,7]
]
</pre>
```
<p>以下<span style="color:red">错误</span>的选项是?</p>
......
......@@ -8,31 +8,23 @@
二叉树:<code>[3,9,20,null,null,15,7]</code>,</p>
<pre>
```
3
/ \
9 20
/ \
15 7
</pre>
```
<p>返回其层序遍历结果:</p>
<pre>
```
[
[3],
[9,20],
[15,7]
]
</pre>
```
<p>以下<span style="color:red">错误</span>的选项是?</p>
......
......@@ -16,7 +16,10 @@
<p><strong>示例 1:</strong></p><img
src="https://cdn.jsdelivr.net/gh/doocs/leetcode@main/solution/0000-0099/0036.Valid%20Sudoku/images/250px-sudoku-by-l2g-20050714svg.png"
style="height:250px; width:250px" />
<pre><strong>输入:</strong>board =
<strong>输入:</strong>
```
board =
[["5","3",".",".","7",".",".",".","."]
,["6",".",".","1","9","5",".",".","."]
,[".","9","8",".",".",".",".","6","."]
......@@ -26,10 +29,15 @@
,[".","6",".",".",".",".","2","8","."]
,[".",".",".","4","1","9",".",".","5"]
,[".",".",".",".","8",".",".","7","9"]]
```
<strong><br />输出:</strong>true
</pre>
<p><strong>示例 2:</strong></p>
<pre><strong>输入:</strong>board =
<strong>输入:</strong>
```
board =
[["8","3",".",".","7",".",".",".","."]
,["6",".",".","1","9","5",".",".","."]
,[".","9","8",".",".",".",".","6","."]
......@@ -39,8 +47,10 @@
,[".","6",".",".",".",".","2","8","."]
,[".",".",".","4","1","9",".",".","5"]
,[".",".",".",".","8",".",".","7","9"]]
```
<strong><br />输出:</strong>false
<strong><br />解释:</strong>除了第一行的第一个数字从<strong> 5</strong> 改为 <strong>8 </strong>以外,空格内其他数字均与 示例1 相同。 但由于位于左上角的 3x3 宫内有两个 8 存在, 因此这个数独是无效的。</pre>
<strong><br />解释:</strong>除了第一行的第一个数字从<strong> 5</strong> 改为 <strong>8 </strong>以外,空格内其他数字均与 示例1 相同。 但由于位于左上角的 3x3 宫内有两个 8 存在, 因此这个数独是无效的。
<p> </p>
<p><strong>提示:</strong></p>
<ul>
......
......@@ -25,7 +25,6 @@
<p><strong>示例 2:</strong></p>
<pre>
<strong>输入:</strong>beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot","log"]
<strong>输出:</strong>0
......
......@@ -4,12 +4,12 @@
<p>图中的每个节点都包含它的值 <code>val</code><code>int</code>) 和其邻居的列表(<code>list[Node]</code>)。</p>
<pre>class Node {
```java
class Node {
public int val;
public List&lt;Node&gt; neighbors;
}</pre>
}
```
<p>&nbsp;</p>
......
# 整数转罗马数字
<div class="notranslate">
<p>罗马数字包含以下七种字符:&nbsp;<code>I</code>&nbsp;<code>V</code>&nbsp;<code>X</code>&nbsp;<code>L</code><code>C</code><code>D</code>&nbsp;&nbsp;<code>M</code>
</p>
<p>罗马数字包含以下七种字符:&nbsp;<code>I</code>&nbsp;<code>V</code>&nbsp;<code>X</code>&nbsp;<code>L</code><code>C</code><code>D</code>&nbsp;&nbsp;<code>M</code>
</p>
<pre><strong>字符</strong> <strong>数值</strong>
```
字符 数值
I 1
V 5
X 10
L 50
C 100
D 500
M 1000</pre>
M 1000
```
<p>例如, 罗马数字 2 写做&nbsp;<code>II</code>&nbsp;,即为两个并列的 1。12
写做&nbsp;<code>XII</code>&nbsp;,即为&nbsp;<code>X</code>&nbsp;+&nbsp;<code>II</code>&nbsp;。 27
写做&nbsp;&nbsp;<code>XXVII</code>,
即为&nbsp;<code>XX</code>&nbsp;+&nbsp;<code>V</code>&nbsp;+&nbsp;<code>II</code>&nbsp;。</p>
<p>例如, 罗马数字 2 写做&nbsp;<code>II</code>&nbsp;,即为两个并列的 1。12
写做&nbsp;<code>XII</code>&nbsp;,即为&nbsp;<code>X</code>&nbsp;+&nbsp;<code>II</code>&nbsp;。 27
写做&nbsp;&nbsp;<code>XXVII</code>,
即为&nbsp;<code>XX</code>&nbsp;+&nbsp;<code>V</code>&nbsp;+&nbsp;<code>II</code>&nbsp;</p>
<p>通常情况下,罗马数字中小的数字在大的数字的右边。但也存在特例,例如 4 不写做&nbsp;<code>IIII</code>,而是&nbsp;<code>IV</code>。数字 1 在数字 5 的左边,所表示的数等于大数 5
减小数 1 得到的数值 4 。同样地,数字 9 表示为&nbsp;<code>IX</code>。这个特殊的规则只适用于以下六种情况:</p>
<p>通常情况下,罗马数字中小的数字在大的数字的右边。但也存在特例,例如 4 不写做&nbsp;<code>IIII</code>,而是&nbsp;<code>IV</code>。数字 1 在数字 5 的左边,所表示的数等于大数 5
减小数 1 得到的数值 4 。同样地,数字 9 表示为&nbsp;<code>IX</code>。这个特殊的规则只适用于以下六种情况:</p>
<ul>
<li><code>I</code>&nbsp;可以放在&nbsp;<code>V</code>&nbsp;(5) 和&nbsp;<code>X</code>&nbsp;(10) 的左边,来表示 4 和 9。</li>
<li><code>X</code>&nbsp;可以放在&nbsp;<code>L</code>&nbsp;(50) 和&nbsp;<code>C</code>&nbsp;(100) 的左边,来表示 40
和&nbsp;90。&nbsp;</li>
<li><code>C</code>&nbsp;可以放在&nbsp;<code>D</code>&nbsp;(500) 和&nbsp;<code>M</code>&nbsp;(1000) 的左边,来表示&nbsp;400
和&nbsp;900。</li>
</ul>
<ul>
<li><code>I</code>&nbsp;可以放在&nbsp;<code>V</code>&nbsp;(5) 和&nbsp;<code>X</code>&nbsp;(10) 的左边,来表示 4 和 9。</li>
<li><code>X</code>&nbsp;可以放在&nbsp;<code>L</code>&nbsp;(50) 和&nbsp;<code>C</code>&nbsp;(100) 的左边,来表示 40
&nbsp;90。&nbsp;</li>
<li><code>C</code>&nbsp;可以放在&nbsp;<code>D</code>&nbsp;(500) 和&nbsp;<code>M</code>&nbsp;(1000) 的左边,来表示&nbsp;400
&nbsp;900。</li>
</ul>
<p>给你一个整数,将其转为罗马数字。</p>
<p>给你一个整数,将其转为罗马数字。</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>示例&nbsp;1:</strong></p>
<p><strong>示例&nbsp;1:</strong></p>
<pre><strong>输入:</strong>&nbsp;num = 3
<pre><strong>输入:</strong>&nbsp;num = 3
<strong><br />输出:</strong> "III"</pre>
<p><strong>示例&nbsp;2:</strong></p>
<p><strong>示例&nbsp;2:</strong></p>
<pre><strong>输入:</strong>&nbsp;num = 4
<pre><strong>输入:</strong>&nbsp;num = 4
<strong><br />输出:</strong> "IV"</pre>
<p><strong>示例&nbsp;3:</strong></p>
<p><strong>示例&nbsp;3:</strong></p>
<pre><strong>输入:</strong>&nbsp;num = 9
<pre><strong>输入:</strong>&nbsp;num = 9
<strong><br />输出:</strong> "IX"</pre>
<p><strong>示例&nbsp;4:</strong></p>
<p><strong>示例&nbsp;4:</strong></p>
<pre><strong>输入:</strong>&nbsp;num = 58
<pre><strong>输入:</strong>&nbsp;num = 58
<strong><br />输出:</strong> "LVIII"
<strong><br />解释:</strong> L = 50, V = 5, III = 3.
</pre>
</pre>
<p><strong>示例&nbsp;5:</strong></p>
<p><strong>示例&nbsp;5:</strong></p>
<pre><strong>输入:</strong>&nbsp;num = 1994
<pre><strong>输入:</strong>&nbsp;num = 1994
<strong><br />输出:</strong> "MCMXCIV"
<strong><br />解释:</strong> M = 1000, CM = 900, XC = 90, IV = 4.</pre>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= num &lt;= 3999</code></li>
</ul>
<ul>
<li><code>1 &lt;= num &lt;= 3999</code></li>
</ul>
</div>
<p>以下<span style="color:red">错误</span>的选项是?</p>
## aop
......
# 罗马数字转整数
<div class="notranslate">
<p>罗马数字包含以下七种字符:&nbsp;<code>I</code>&nbsp;<code>V</code>&nbsp;<code>X</code>&nbsp;<code>L</code><code>C</code><code>D</code>&nbsp;&nbsp;<code>M</code>
</p>
<p>罗马数字包含以下七种字符:&nbsp;<code>I</code>&nbsp;<code>V</code>&nbsp;<code>X</code>&nbsp;<code>L</code><code>C</code><code>D</code>&nbsp;&nbsp;<code>M</code>
</p>
<pre><strong>字符</strong> <strong>数值</strong>
```
字符 数值
I 1
V 5
X 10
L 50
C 100
D 500
M 1000</pre>
M 1000
```
<p>例如, 罗马数字 2 写做&nbsp;<code>II</code>&nbsp;,即为两个并列的 1。12
写做&nbsp;<code>XII</code>&nbsp;,即为&nbsp;<code>X</code>&nbsp;+&nbsp;<code>II</code>&nbsp;。 27
写做&nbsp;&nbsp;<code>XXVII</code>,
即为&nbsp;<code>XX</code>&nbsp;+&nbsp;<code>V</code>&nbsp;+&nbsp;<code>II</code>&nbsp;。</p>
<p>例如, 罗马数字 2 写做&nbsp;<code>II</code>&nbsp;,即为两个并列的 1。12
写做&nbsp;<code>XII</code>&nbsp;,即为&nbsp;<code>X</code>&nbsp;+&nbsp;<code>II</code>&nbsp;。 27
写做&nbsp;&nbsp;<code>XXVII</code>,
即为&nbsp;<code>XX</code>&nbsp;+&nbsp;<code>V</code>&nbsp;+&nbsp;<code>II</code>&nbsp;</p>
<p>通常情况下,罗马数字中小的数字在大的数字的右边。但也存在特例,例如 4 不写做&nbsp;<code>IIII</code>,而是&nbsp;<code>IV</code>。数字 1 在数字 5 的左边,所表示的数等于大数 5
减小数 1 得到的数值 4 。同样地,数字 9 表示为&nbsp;<code>IX</code>。这个特殊的规则只适用于以下六种情况:</p>
<p>通常情况下,罗马数字中小的数字在大的数字的右边。但也存在特例,例如 4 不写做&nbsp;<code>IIII</code>,而是&nbsp;<code>IV</code>。数字 1 在数字 5 的左边,所表示的数等于大数 5
减小数 1 得到的数值 4 。同样地,数字 9 表示为&nbsp;<code>IX</code>。这个特殊的规则只适用于以下六种情况:</p>
<ul>
<li><code>I</code>&nbsp;可以放在&nbsp;<code>V</code>&nbsp;(5) 和&nbsp;<code>X</code>&nbsp;(10) 的左边,来表示 4 和 9。</li>
<li><code>X</code>&nbsp;可以放在&nbsp;<code>L</code>&nbsp;(50) 和&nbsp;<code>C</code>&nbsp;(100) 的左边,来表示 40
和&nbsp;90。&nbsp;</li>
<li><code>C</code>&nbsp;可以放在&nbsp;<code>D</code>&nbsp;(500) 和&nbsp;<code>M</code>&nbsp;(1000) 的左边,来表示&nbsp;400
和&nbsp;900。</li>
</ul>
<ul>
<li><code>I</code>&nbsp;可以放在&nbsp;<code>V</code>&nbsp;(5) 和&nbsp;<code>X</code>&nbsp;(10) 的左边,来表示 4 和 9。</li>
<li><code>X</code>&nbsp;可以放在&nbsp;<code>L</code>&nbsp;(50) 和&nbsp;<code>C</code>&nbsp;(100) 的左边,来表示 40
&nbsp;90。&nbsp;</li>
<li><code>C</code>&nbsp;可以放在&nbsp;<code>D</code>&nbsp;(500) 和&nbsp;<code>M</code>&nbsp;(1000) 的左边,来表示&nbsp;400
&nbsp;900。</li>
</ul>
<p>给你一个整数,将其转为罗马数字。</p>
<p>给你一个整数,将其转为罗马数字。</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>示例&nbsp;1:</strong></p>
<p><strong>示例&nbsp;1:</strong></p>
<pre><strong>输入:</strong>&nbsp;num = 3
<pre><strong>输入:</strong>&nbsp;num = 3
<strong><br />输出:</strong> "III"</pre>
<p><strong>示例&nbsp;2:</strong></p>
<p><strong>示例&nbsp;2:</strong></p>
<pre><strong>输入:</strong>&nbsp;num = 4
<pre><strong>输入:</strong>&nbsp;num = 4
<strong><br />输出:</strong> "IV"</pre>
<p><strong>示例&nbsp;3:</strong></p>
<p><strong>示例&nbsp;3:</strong></p>
<pre><strong>输入:</strong>&nbsp;num = 9
<pre><strong>输入:</strong>&nbsp;num = 9
<strong><br />输出:</strong> "IX"</pre>
<p><strong>示例&nbsp;4:</strong></p>
<p><strong>示例&nbsp;4:</strong></p>
<pre><strong>输入:</strong>&nbsp;num = 58
<pre><strong>输入:</strong>&nbsp;num = 58
<strong><br />输出:</strong> "LVIII"
<strong><br />解释:</strong> L = 50, V = 5, III = 3.
</pre>
</pre>
<p><strong>示例&nbsp;5:</strong></p>
<p><strong>示例&nbsp;5:</strong></p>
<pre><strong>输入:</strong>&nbsp;num = 1994
<pre><strong>输入:</strong>&nbsp;num = 1994
<strong><br />输出:</strong> "MCMXCIV"
<strong><br />解释:</strong> M = 1000, CM = 900, XC = 90, IV = 4.</pre>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= num &lt;= 3999</code></li>
</ul>
</div>
<ul>
<li><code>1 &lt;= num &lt;= 3999</code></li>
</ul>
<p>以下<span style="color:red">错误</span>的选项是?</p>
## aop
......
......@@ -16,34 +16,32 @@
<p><strong>示例:</strong></p>
<pre>
<strong>输入</strong>
```json
["Twitter", "postTweet", "getNewsFeed", "follow", "postTweet", "getNewsFeed", "unfollow", "getNewsFeed"]
[[], [1, 5], [1], [1, 2], [2, 6], [1], [1, 2], [1]]
```
<strong>输出</strong>
```json
[null, null, [5], null, null, [6, 5], null, [5]]
```
<strong>解释</strong>
```java
Twitter twitter = new Twitter();
twitter.postTweet(1, 5); // 用户 1 发送了一条新推文 (用户 id = 1, 推文 id = 5)
twitter.getNewsFeed(1); // 用户 1 的获取推文应当返回一个列表,其中包含一个 id 为 5 的推文
twitter.follow(1, 2); // 用户 1 关注了用户 2
twitter.postTweet(2, 6); // 用户 2 发送了一个新推文 (推文 id = 6)
twitter.getNewsFeed(1); // 用户 1 的获取推文应当返回一个列表,其中包含两个推文,id 分别为 -&gt; [6, 5] 。推文 id 6 应当在推文 id 5 之前,因为它是在 5 之后发送的
twitter.unfollow(1, 2); // 用户 1 取消关注了用户 2
twitter.getNewsFeed(1); // 用户 1 获取推文应当返回一个列表,其中包含一个 id 为 5 的推文。因为用户 1 已经不再关注用户 2</pre>
twitter.getNewsFeed(1); // 用户 1 获取推文应当返回一个列表,其中包含一个 id 为 5 的推文。因为用户 1 已经不再关注用户 2
```
<p>&nbsp;</p>
......
......@@ -17,36 +17,31 @@
<p><strong>示例:</strong></p>
<pre>
<strong>输入</strong>
```json
["RandomizedSet", "insert", "remove", "insert", "getRandom", "remove", "insert", "getRandom"]
[[], [1], [2], [2], [], [1], [2], []]
```
<strong>输出</strong>
```json
[null, true, false, true, 2, true, false, 2]
```
<strong>解释</strong>
```java
RandomizedSet randomizedSet = new RandomizedSet();
randomizedSet.insert(1); // 向集合中插入 1 。返回 true 表示 1 被成功地插入。
randomizedSet.remove(2); // 返回 false ,表示集合中不存在 2 。
randomizedSet.insert(2); // 向集合中插入 2 。返回 true 。集合现在包含 [1,2] 。
randomizedSet.getRandom(); // getRandom 应随机返回 1 或 2 。
randomizedSet.remove(1); // 从集合中移除 1 ,返回 true 。集合现在包含 [2] 。
randomizedSet.insert(2); // 2 已在集合中,所以返回 false 。
randomizedSet.getRandom(); // 由于 2 是集合中唯一的数字,getRandom 总是返回 2 。
</pre>
```
<p>&nbsp;</p>
......
......@@ -7,14 +7,14 @@
<li>数字 <code>1-9</code> 在每一列只能出现一次。</li>
<li>数字 <code>1-9</code> 在每一个以粗实线分隔的 <code>3x3</code> 宫内只能出现一次。(请参考示例图)</li>
</ol>
<p>数独部分空格内已填入了数字,空白格用 <code>'.'</code> 表示。</p>
<p> </p>
<div class="top-view__1vxA">
<div class="original__bRMd">
<div>
<p><strong>示例:</strong></p><img
src="https://cdn.jsdelivr.net/gh/doocs/leetcode@main/solution/0000-0099/0037.Sudoku%20Solver/images/250px-sudoku-by-l2g-20050714svg.png" />
<pre><strong>输入:</strong>board =
<p><strong>示例:</strong></p><img
src="https://cdn.jsdelivr.net/gh/doocs/leetcode@main/solution/0000-0099/0037.Sudoku%20Solver/images/250px-sudoku-by-l2g-20050714svg.png" />
<strong>输入:</strong>
```
board =
[["5","3",".",".","7",".",".",".","."],
["6",".",".","1","9","5",".",".","."],
[".","9","8",".",".",".",".","6","."],
......@@ -24,7 +24,11 @@
[".","6",".",".",".",".","2","8","."],
[".",".",".","4","1","9",".",".","5"],
[".",".",".",".","8",".",".","7","9"]]
```
<strong><br />输出:</strong>
```
[["5","3","4","6","7","8","9","1","2"],
["6","7","2","1","9","5","3","4","8"],
["1","9","8","3","4","2","5","6","7"],
......@@ -34,23 +38,21 @@
["9","6","1","5","3","7","2","8","4"],
["2","8","7","4","1","9","6","3","5"],
["3","4","5","2","8","6","1","7","9"]]
```
<strong><br />解释:</strong>输入的数独如上图所示,唯一有效的解决方案如下所示:
<p> </p>
</pre>
<img src="https://cdn.jsdelivr.net/gh/doocs/leetcode@main/solution/0000-0099/0037.Sudoku%20Solver/images/250px-sudoku-by-l2g-20050714_solutionsvg.png"
style="height:250px; width:250px" />
<p> </p>
<p><strong>提示:</strong></p>
<ul>
<li><code>board.length == 9</code></li>
<li><code>board[i].length == 9</code></li>
<li><code>board[i][j]</code> 是一位数字或者 <code>'.'</code></li>
<li>题目数据 <strong>保证</strong> 输入数独仅有一个解</li>
</ul>
</div>
</div>
</div>
<img src="https://cdn.jsdelivr.net/gh/doocs/leetcode@main/solution/0000-0099/0037.Sudoku%20Solver/images/250px-sudoku-by-l2g-20050714_solutionsvg.png"
style="height:250px; width:250px" />
<p><strong>提示:</strong></p>
<ul>
<li><code>board.length == 9</code></li>
<li><code>board[i].length == 9</code></li>
<li><code>board[i][j]</code> 是一位数字或者 <code>'.'</code></li>
<li>题目数据 <strong>保证</strong> 输入数独仅有一个解</li>
</ul>
<p>以下<span style="color:red">错误</span>的选项是?</p>
......
# 文本左右对齐
<div class="notranslate">
<p>给定一个单词数组和一个长度&nbsp;<em>maxWidth</em>,重新排版单词,使其成为每行恰好有&nbsp;<em>maxWidth</em>&nbsp;个字符,且左右两端对齐的文本。</p>
<p>给定一个单词数组和一个长度&nbsp;<em>maxWidth</em>,重新排版单词,使其成为每行恰好有&nbsp;<em>maxWidth</em>&nbsp;个字符,且左右两端对齐的文本。</p>
<p>你应该使用“贪心算法”来放置给定的单词;也就是说,尽可能多地往每行中放置单词。必要时可用空格&nbsp;<code>' '</code>&nbsp;填充,使得每行恰好有 <em>maxWidth</em>&nbsp;个字符。
</p>
<p>你应该使用“贪心算法”来放置给定的单词;也就是说,尽可能多地往每行中放置单词。必要时可用空格&nbsp;<code>' '</code>&nbsp;填充,使得每行恰好有 <em>maxWidth</em>&nbsp;个字符。
</p>
<p>要求尽可能均匀分配单词间的空格数量。如果某一行单词间的空格不能均匀分配,则左侧放置的空格数要多于右侧的空格数。</p>
<p>要求尽可能均匀分配单词间的空格数量。如果某一行单词间的空格不能均匀分配,则左侧放置的空格数要多于右侧的空格数。</p>
<p>文本的最后一行应为左对齐,且单词之间不插入<strong>额外的</strong>空格。</p>
<p>文本的最后一行应为左对齐,且单词之间不插入<strong>额外的</strong>空格。</p>
<p><strong>说明:</strong></p>
<p><strong>说明:</strong></p>
<ul>
<li>单词是指由非空格字符组成的字符序列。</li>
<li>每个单词的长度大于 0,小于等于&nbsp;<em>maxWidth</em></li>
<li>输入单词数组 <code>words</code>&nbsp;至少包含一个单词。</li>
</ul>
<ul>
<li>单词是指由非空格字符组成的字符序列。</li>
<li>每个单词的长度大于 0,小于等于&nbsp;<em>maxWidth</em></li>
<li>输入单词数组 <code>words</code>&nbsp;至少包含一个单词。</li>
</ul>
<p><strong>示例:</strong></p>
<p><strong>示例:</strong></p>
<pre><strong>输入:</strong>
words = ["This", "is", "an", "example", "of", "text", "justification."]
maxWidth = 16
<pre><strong>输入:</strong>
words = ["This", "is", "an", "example", "of", "text", "justification."]
maxWidth = 16
<strong><br />输出:</strong>
[
&nbsp; &nbsp;"This &nbsp; &nbsp;is &nbsp; &nbsp;an",
&nbsp; &nbsp;"example &nbsp;of text",
&nbsp; &nbsp;"justification. &nbsp;"
]
</pre>
[
&nbsp; &nbsp;"This &nbsp; &nbsp;is &nbsp; &nbsp;an",
&nbsp; &nbsp;"example &nbsp;of text",
&nbsp; &nbsp;"justification. &nbsp;"
]
</pre>
<p><strong>示例&nbsp;2:</strong></p>
<p><strong>示例&nbsp;2:</strong></p>
<pre><strong>输入:</strong>
words = ["What","must","be","acknowledgment","shall","be"]
maxWidth = 16
<pre><strong>输入:</strong>
words = ["What","must","be","acknowledgment","shall","be"]
maxWidth = 16
<strong><br />输出:</strong>
[
&nbsp; "What &nbsp; must &nbsp; be",
&nbsp; "acknowledgment &nbsp;",
&nbsp; "shall be &nbsp; &nbsp; &nbsp; &nbsp;"
]
[
&nbsp; "What &nbsp; must &nbsp; be",
&nbsp; "acknowledgment &nbsp;",
&nbsp; "shall be &nbsp; &nbsp; &nbsp; &nbsp;"
]
<strong><br />解释: </strong>注意最后一行的格式应为 "shall be " 而不是 "shall be"
因为最后一行应为左对齐,而不是左右两端对齐,第二行同样为左对齐,这是因为这行只包含一个单词。
</pre>
因为最后一行应为左对齐,而不是左右两端对齐,第二行同样为左对齐,这是因为这行只包含一个单词。
</pre>
<p><strong>示例&nbsp;3:</strong></p>
<p><strong>示例&nbsp;3:</strong></p>
<pre><strong>输入:</strong>
words = ["Science","is","what","we","understand","well","enough","to","explain",
&nbsp; "to","a","computer.","Art","is","everything","else","we","do"]
maxWidth = 20
<pre><strong>输入:</strong>
words = ["Science","is","what","we","understand","well","enough","to","explain",
&nbsp; "to","a","computer.","Art","is","everything","else","we","do"]
maxWidth = 20
<strong><br />输出:</strong>
[
&nbsp; "Science &nbsp;is &nbsp;what we",
"understand &nbsp; &nbsp; &nbsp;well",
&nbsp; "enough to explain to",
&nbsp; "a &nbsp;computer. &nbsp;Art is",
&nbsp; "everything &nbsp;else &nbsp;we",
&nbsp; "do &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"
]
</pre>
</div>
[
&nbsp; "Science &nbsp;is &nbsp;what we",
"understand &nbsp; &nbsp; &nbsp;well",
&nbsp; "enough to explain to",
&nbsp; "a &nbsp;computer. &nbsp;Art is",
&nbsp; "everything &nbsp;else &nbsp;we",
&nbsp; "do &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"
]
</pre>
<p>以下<span style="color:red">错误</span>的选项是?</p>
## aop
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册