mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-04-18 08:39:41 +08:00
更新国外版力扣题目描述变更
This commit is contained in:
parent
7646741306
commit
7deedf5990
leetcode/problem
@ -1,4 +1,4 @@
|
||||
<p>There is only one character <code>'A'</code> on the screen of a notepad. You can perform two operations on this notepad for each step:</p>
|
||||
<p>There is only one character <code>'A'</code> on the screen of a notepad. You can perform one of two operations on this notepad for each step:</p>
|
||||
|
||||
<ul>
|
||||
<li>Copy All: You can copy all the characters present on the screen (a partial copy is not allowed).</li>
|
||||
@ -13,7 +13,7 @@
|
||||
<pre>
|
||||
<strong>Input:</strong> n = 3
|
||||
<strong>Output:</strong> 3
|
||||
<strong>Explanation:</strong> Intitally, we have one character 'A'.
|
||||
<strong>Explanation:</strong> Initially, we have one character 'A'.
|
||||
In step 1, we use Copy All operation.
|
||||
In step 2, we use Paste operation to get 'AA'.
|
||||
In step 3, we use Paste operation to get 'AAA'.
|
||||
|
@ -27,6 +27,14 @@ We choose one 1 from [1,1] in 2 ways,
|
||||
and two 2s from [2,2,2,2] in 6 ways.
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> arr = [2,1,3], target = 6
|
||||
<strong>Output:</strong> 1
|
||||
<strong>Explanation:</strong> (1, 2, 3) occured one time in the array so we return 1.
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<p>Your country has an infinite number of lakes. Initially, all the lakes are empty, but when it rains over the <code>nth</code> lake, the <code>nth</code> lake becomes full of water. If it rains over a lake which is <strong>full of water</strong>, there will be a <strong>flood</strong>. Your goal is to avoid the flood in any lake.</p>
|
||||
<p>Your country has an infinite number of lakes. Initially, all the lakes are empty, but when it rains over the <code>nth</code> lake, the <code>nth</code> lake becomes full of water. If it rains over a lake that is <strong>full of water</strong>, there will be a <strong>flood</strong>. Your goal is to avoid floods in any lake.</p>
|
||||
|
||||
<p>Given an integer array <code>rains</code> where:</p>
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
<p>If there are multiple valid answers return <strong>any</strong> of them. If it is impossible to avoid flood return <strong>an empty array</strong>.</p>
|
||||
|
||||
<p>Notice that if you chose to dry a full lake, it becomes empty, but if you chose to dry an empty lake, nothing changes. (see example 4)</p>
|
||||
<p>Notice that if you chose to dry a full lake, it becomes empty, but if you chose to dry an empty lake, nothing changes.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
|
@ -9,7 +9,7 @@
|
||||
<li><code>"C"</code> - Invalidate the previous score, removing it from the record. It is guaranteed there will always be a previous score.</li>
|
||||
</ol>
|
||||
|
||||
<p>Return <em>the sum of all the scores on the record</em>.</p>
|
||||
<p>Return <em>the sum of all the scores on the record</em>. The test cases are generated so that the answer fits in a 32-bit integer.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
|
@ -36,5 +36,5 @@
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= x, y <= 10<sup>9</sup></code></li>
|
||||
<li><code>1 <= startValue, target <= 10<sup>9</sup></code></li>
|
||||
</ul>
|
||||
|
@ -8,6 +8,7 @@
|
||||
| num | varchar |
|
||||
+-------------+---------+
|
||||
id is the primary key for this table.
|
||||
id is an autoincrement column.
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<strong>Input:</strong> s = "ABC"
|
||||
<strong>Output:</strong> 10
|
||||
<strong>Explanation: </strong>All possible substrings are: "A","B","C","AB","BC" and "ABC".
|
||||
Evey substring is composed with only unique letters.
|
||||
Every substring is composed with only unique letters.
|
||||
Sum of lengths of all substring is 1 + 1 + 1 + 2 + 2 + 3 = 10
|
||||
</pre>
|
||||
|
||||
|
@ -7,6 +7,8 @@
|
||||
<li>Replace <code>c</code> with <code>values[i]</code> in the string.</li>
|
||||
</ol>
|
||||
|
||||
<p>Note that in case a character of the string is <strong>not present</strong> in <code>keys</code>, the encryption process cannot be carried out, and an empty string <code>""</code> is returned.</p>
|
||||
|
||||
<p>A string is <strong>decrypted</strong> with the following process:</p>
|
||||
|
||||
<ol>
|
||||
|
@ -32,8 +32,8 @@ solution.shuffle(); // Returns the random shuffling of array [1,2,3]. Example
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= nums.length <= 200</code></li>
|
||||
<li><code>1 <= nums.length <= 50</code></li>
|
||||
<li><code>-10<sup>6</sup> <= nums[i] <= 10<sup>6</sup></code></li>
|
||||
<li>All the elements of <code>nums</code> are <strong>unique</strong>.</li>
|
||||
<li>At most <code>5 * 10<sup>4</sup></code> calls <strong>in total</strong> will be made to <code>reset</code> and <code>shuffle</code>.</li>
|
||||
<li>At most <code>10<sup>4</sup></code> calls <strong>in total</strong> will be made to <code>reset</code> and <code>shuffle</code>.</li>
|
||||
</ul>
|
||||
|
@ -1,10 +1,10 @@
|
||||
<p>A robot is located at the top-left corner of a <code>m x n</code> grid (marked 'Start' in the diagram below).</p>
|
||||
<p>You are given an <code>m x n</code> integer array <code>grid</code>. There is a robot initially located at the <b>top-left corner</b> (i.e., <code>grid[0][0]</code>). The robot tries to move to the <strong>bottom-right corner</strong> (i.e., <code>grid[m-1][n-1]</code>). The robot can only move either down or right at any point in time.</p>
|
||||
|
||||
<p>The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below).</p>
|
||||
<p>An obstacle and space are marked as <code>1</code> or <code>0</code> respectively in <code>grid</code>. A path that the robot takes cannot include <strong>any</strong> square that is an obstacle.</p>
|
||||
|
||||
<p>Now consider if some obstacles are added to the grids. How many unique paths would there be?</p>
|
||||
<p>Return <em>the number of possible unique paths that the robot can take to reach the bottom-right corner</em>.</p>
|
||||
|
||||
<p>An obstacle and space is marked as <code>1</code> and <code>0</code> respectively in the grid.</p>
|
||||
<p>The testcases are generated so that the answer will be less than or equal to <code>2 * 10<sup>9</sup></code>.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
@ -29,8 +29,8 @@ There are two ways to reach the bottom-right corner:
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>m == obstacleGrid.length</code></li>
|
||||
<li><code>n == obstacleGrid[i].length</code></li>
|
||||
<li><code>m == obstacleGrid.length</code></li>
|
||||
<li><code>n == obstacleGrid[i].length</code></li>
|
||||
<li><code>1 <= m, n <= 100</code></li>
|
||||
<li><code>obstacleGrid[i][j]</code> is <code>0</code> or <code>1</code>.</li>
|
||||
</ul>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<p>Given an integer array <code>data</code> representing the data, return whether it is a valid <strong>UTF-8</strong> encoding.</p>
|
||||
<p>Given an integer array <code>data</code> representing the data, return whether it is a valid <strong>UTF-8</strong> encoding (i.e. it translates to a sequence of valid UTF-8 encoded characters).</p>
|
||||
|
||||
<p>A character in <strong>UTF8</strong> can be from <b>1 to 4 bytes</b> long, subjected to the following rules:</p>
|
||||
<p>A character in <strong>UTF8</strong> can be from <strong>1 to 4 bytes</strong> long, subjected to the following rules:</p>
|
||||
|
||||
<ol>
|
||||
<li>For a <strong>1-byte</strong> character, the first bit is a <code>0</code>, followed by its Unicode code.</li>
|
||||
@ -10,16 +10,18 @@
|
||||
<p>This is how the UTF-8 encoding would work:</p>
|
||||
|
||||
<pre>
|
||||
<code> Char. number range | UTF-8 octet sequence
|
||||
(hexadecimal) | (binary)
|
||||
--------------------+---------------------------------------------
|
||||
0000 0000-0000 007F | 0xxxxxxx
|
||||
0000 0080-0000 07FF | 110xxxxx 10xxxxxx
|
||||
0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx
|
||||
0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx</code>
|
||||
Number of Bytes | UTF-8 Octet Sequence
|
||||
| (binary)
|
||||
--------------------+-----------------------------------------
|
||||
1 | 0xxxxxxx
|
||||
2 | 110xxxxx 10xxxxxx
|
||||
3 | 1110xxxx 10xxxxxx 10xxxxxx
|
||||
4 | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
|
||||
</pre>
|
||||
|
||||
<p><b>Note: </b>The input is an array of integers. Only the <b>least significant 8 bits</b> of each integer is used to store the data. This means each integer represents only 1 byte of data.</p>
|
||||
<p><code>x</code> denotes a bit in the binary form of a byte that may be either <code>0</code> or <code>1</code>.</p>
|
||||
|
||||
<p><strong>Note: </strong>The input is an array of integers. Only the <strong>least significant 8 bits</strong> of each integer is used to store the data. This means each integer represents only 1 byte of data.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
|
Loading…
x
Reference in New Issue
Block a user