You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: solution/0000-0099/0046.Permutations/README_EN.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ tags:
17
17
18
18
<!-- description:start -->
19
19
20
-
<p>Given an array <code>nums</code> of distinct integers, return <em>all the possible permutations</em>. You can return the answer in <strong>any order</strong>.</p>
20
+
<p>Given an array <code>nums</code> of distinct integers, return all the possible <spandata-keyword="permutation-array">permutations</span>. You can return the answer in <strong>any order</strong>.</p>
Copy file name to clipboardexpand all lines: solution/0400-0499/0438.Find All Anagrams in a String/README_EN.md
+1-3
Original file line number
Diff line number
Diff line change
@@ -18,9 +18,7 @@ tags:
18
18
19
19
<!-- description:start -->
20
20
21
-
<p>Given two strings <code>s</code> and <code>p</code>, return <em>an array of all the start indices of </em><code>p</code><em>'s anagrams in </em><code>s</code>. You may return the answer in <strong>any order</strong>.</p>
22
-
23
-
<p>An <strong>Anagram</strong> is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.</p>
21
+
<p>Given two strings <code>s</code> and <code>p</code>, return an array of all the start indices of <code>p</code>'s <spandata-keyword="anagram">anagrams</span> in <code>s</code>. You may return the answer in <strong>any order</strong>.</p>
Copy file name to clipboardexpand all lines: solution/0500-0599/0567.Permutation in String/README_EN.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ tags:
19
19
20
20
<!-- description:start -->
21
21
22
-
<p>Given two strings <code>s1</code> and <code>s2</code>, return <code>true</code><em> if </em><code>s2</code><em> contains a permutation of </em><code>s1</code><em>, or </em><code>false</code><em> otherwise</em>.</p>
22
+
<p>Given two strings <code>s1</code> and <code>s2</code>, return <code>true</code> if <code>s2</code> contains a <spandata-keyword="permutation-string">permutation</span> of <code>s1</code>, or <code>false</code> otherwise.</p>
23
23
24
24
<p>In other words, return <code>true</code> if one of <code>s1</code>'s permutations is the substring of <code>s2</code>.</p>
Copy file name to clipboardexpand all lines: solution/0600-0699/0666.Path Sum IV/README_EN.md
+31-19
Original file line number
Diff line number
Diff line change
@@ -20,36 +20,48 @@ tags:
20
20
21
21
<!-- description:start -->
22
22
23
-
<p>If the depth of a tree is smaller than <code>5</code>, then this tree can be represented by an array of three-digit integers. For each integer in this array:</p>
23
+
<p>If the depth of a tree is smaller than <code>5</code>, then this tree can be represented by an array of three-digit integers. You are given an <strong>ascending </strong>array <code>nums</code> consisting of three-digit integers representing a binary tree with a depth smaller than <code>5</code>, where for each integer:</p>
24
24
25
25
<ul>
26
-
<li>The hundreds digit represents the depth <code>d</code> of this node where <code>1 <= d <= 4</code>.</li>
27
-
<li>The tens digit represents the position <code>p</code> of this node in the level it belongs to where <code>1 <= p <= 8</code>. The position is the same as that in a full binary tree.</li>
28
-
<li>The units digit represents the value <code>v</code> of this node where <code>0 <= v <= 9</code>.</li>
26
+
<li>The hundreds digit represents the depth <code>d</code> of this node, where <code>1 <= d <= 4</code>.</li>
27
+
<li>The tens digit represents the position <code>p</code> of this node within its level, where <code>1 <= p <= 8</code>, corresponding to its position in a <strong>full binary tree</strong>.</li>
28
+
<li>The units digit represents the value <code>v</code> of this node, where <code>0 <= v <= 9</code>.</li>
29
29
</ul>
30
30
31
-
<p>Given an array of <strong>ascending</strong> three-digit integers <code>nums</code> representing a binary tree with a depth smaller than <code>5</code>, return <em>the sum of all paths from the root towards the leaves</em>.</p>
31
+
<p>Return the <strong>sum</strong> of <strong>all paths</strong> from the <strong>root</strong> towards the <strong>leaves</strong>.</p>
32
32
33
33
<p>It is <strong>guaranteed</strong> that the given array represents a valid connected binary tree.</p>
Copy file name to clipboardexpand all lines: solution/0700-0799/0733.Flood Fill/README_EN.md
+10-5
Original file line number
Diff line number
Diff line change
@@ -19,13 +19,18 @@ tags:
19
19
20
20
<!-- description:start -->
21
21
22
-
<p>An image is represented by an <code>m x n</code> integer grid <code>image</code> where <code>image[i][j]</code> represents the pixel value of the image.</p>
22
+
<p>You are given an image represented by an <code>m x n</code> grid of integers <code>image</code>, where <code>image[i][j]</code> represents the pixel value of the image. You are also given three integers <code>sr</code>, <code>sc</code>, and <code>color</code>. Your task is to perform a <strong>flood fill</strong> on the image starting from the pixel <code>image[sr][sc]</code>.</p>
23
23
24
-
<p>You are also given three integers <code>sr</code>, <code>sc</code>, and <code>color</code>. You should perform a <strong>flood fill</strong> on the image starting from the pixel <code>image[sr][sc]</code>.</p>
24
+
<p>To perform a <strong>flood fill</strong>:</p>
25
25
26
-
<p>To perform a <strong>flood fill</strong>, consider the starting pixel, plus any pixels connected <strong>4-directionally</strong> to the starting pixel of the same color as the starting pixel, plus any pixels connected <strong>4-directionally</strong> to those pixels (also with the same color), and so on. Replace the color of all of the aforementioned pixels with <code>color</code>.</p>
26
+
<ol>
27
+
<li>Begin with the starting pixel and change its color to <code>color</code>.</li>
28
+
<li>Perform the same process for each pixel that is <strong>directly adjacent</strong> (pixels that share a side with the original pixel, either horizontally or vertically) and shares the <strong>same color</strong> as the starting pixel.</li>
29
+
<li>Keep <strong>repeating</strong> this process by checking neighboring pixels of the <em>updated</em> pixels and modifying their color if it matches the original color of the starting pixel.</li>
30
+
<li>The process <strong>stops</strong> when there are <strong>no more</strong> adjacent pixels of the original color to update.</li>
31
+
</ol>
27
32
28
-
<p>Return <em>the modified image after performing the flood fill</em>.</p>
33
+
<p>Return the <strong>modified</strong> image after performing the flood fill.</p>
29
34
30
35
<p> </p>
31
36
<p><strongclass="example">Example 1:</strong></p>
@@ -41,7 +46,7 @@ tags:
41
46
42
47
<p>From the center of the image with position <code>(sr, sc) = (1, 1)</code> (i.e., the red pixel), all pixels connected by a path of the same color as the starting pixel (i.e., the blue pixels) are colored with the new color.</p>
43
48
44
-
<p>Note the bottom corner is <strong>not</strong> colored 2, because it is not 4-directionally connected to the starting pixel.</p>
49
+
<p>Note the bottom corner is <strong>not</strong> colored 2, because it is not horizontally or vertically connected to the starting pixel.</p>
Copy file name to clipboardexpand all lines: solution/1800-1899/1813.Sentence Similarity III/README_EN.md
+37-18
Original file line number
Diff line number
Diff line change
@@ -20,36 +20,55 @@ tags:
20
20
21
21
<!-- description:start -->
22
22
23
-
<p>A sentence is a list of words that are separated by a single space with no leading or trailing spaces. For example, <code>"Hello World"</code>, <code>"HELLO"</code>, <code>"hello world hello world"</code> are all sentences. Words consist of <strong>only</strong> uppercase and lowercase English letters.</p>
23
+
<p>You are given two strings <code>sentence1</code> and <code>sentence2</code>, each representing a <strong>sentence</strong> composed of words. A sentence is a list of <strong>words</strong> that are separated by a <strong>single</strong> space with no leading or trailing spaces. Each word consists of only uppercase and lowercase English characters.</p>
24
24
25
-
<p>Two sentences <code>sentence1</code> and <code>sentence2</code> are <strong>similar</strong> if it is possible to insert an arbitrary sentence <strong>(possibly empty)</strong> inside one of these sentences such that the two sentences become equal. For example, <code>sentence1 = "Hello my name is Jane"</code> and <code>sentence2 = "Hello Jane"</code> can be made equal by inserting <code>"my name is"</code> between <code>"Hello"</code> and <code>"Jane"</code> in <code>sentence2</code>.</p>
25
+
<p>Two sentences <code>s1</code> and <code>s2</code> are considered <strong>similar</strong> if it is possible to insert an arbitrary sentence (<em>possibly empty</em>) inside one of these sentences such that the two sentences become equal. <strong>Note</strong> that the inserted sentence must be separated from existing words by spaces.</p>
26
26
27
-
<p>Given two sentences <code>sentence1</code> and <code>sentence2</code>, return <code>true</code> <em>if </em><code>sentence1</code> <em>and </em><code>sentence2</code> <em>are similar.</em> Otherwise, return <code>false</code>.</p>
27
+
<p>For example,</p>
28
+
29
+
<ul>
30
+
<li><code>s1 = "Hello Jane"</code> and <code>s2 = "Hello my name is Jane"</code> can be made equal by inserting <code>"my name is"</code> between <code>"Hello"</code><font face="monospace"> </font>and <code>"Jane"</code><font face="monospace"> in s1.</font></li>
31
+
<li><font face="monospace"><code>s1 = "Frog cool"</code> </font>and<font face="monospace"> <code>s2 = "Frogs are cool"</code> </font>are <strong>not</strong> similar, since although there is a sentence <code>"s are"</code> inserted into <code>s1</code>, it is not separated from <code>"Frog"</code> by a space.</li>
32
+
</ul>
33
+
34
+
<p>Given two sentences <code>sentence1</code> and <code>sentence2</code>, return <strong>true</strong> if <code>sentence1</code> and <code>sentence2</code> are <strong>similar</strong>. Otherwise, return <strong>false</strong>.</p>
28
35
29
36
<p> </p>
30
37
<p><strongclass="example">Example 1:</strong></p>
31
38
32
-
<pre>
33
-
<strong>Input:</strong> sentence1 = "My name is Haley", sentence2 = "My Haley"
34
-
<strong>Output:</strong> true
35
-
<strong>Explanation:</strong> sentence2 can be turned to sentence1 by inserting "name is" between "My" and "Haley".
36
-
</pre>
39
+
<divclass="example-block">
40
+
<p><strong>Input:</strong> <spanclass="example-io">sentence1 = "My name is Haley", sentence2 = "My Haley"</span></p>
0 commit comments