Skip to content

Commit 4fc02d4

Browse files
committed
Create README - LeetHub
1 parent 4ebee48 commit 4fc02d4

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

0394-decode-string/README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<h2><a href="https://leetcode.com/problems/decode-string/">394. Decode String</a></h2><h3>Medium</h3><hr><p>Given an encoded string, return its decoded string.</p>
2+
3+
<p>The encoding rule is: <code>k[encoded_string]</code>, where the <code>encoded_string</code> inside the square brackets is being repeated exactly <code>k</code> times. Note that <code>k</code> is guaranteed to be a positive integer.</p>
4+
5+
<p>You may assume that the input string is always valid; there are no extra white spaces, square brackets are well-formed, etc. Furthermore, you may assume that the original data does not contain any digits and that digits are only for those repeat numbers, <code>k</code>. For example, there will not be input like <code>3a</code> or <code>2[4]</code>.</p>
6+
7+
<p>The test cases are generated so that the length of the output will never exceed <code>10<sup>5</sup></code>.</p>
8+
9+
<p>&nbsp;</p>
10+
<p><strong class="example">Example 1:</strong></p>
11+
12+
<pre>
13+
<strong>Input:</strong> s = &quot;3[a]2[bc]&quot;
14+
<strong>Output:</strong> &quot;aaabcbc&quot;
15+
</pre>
16+
17+
<p><strong class="example">Example 2:</strong></p>
18+
19+
<pre>
20+
<strong>Input:</strong> s = &quot;3[a2[c]]&quot;
21+
<strong>Output:</strong> &quot;accaccacc&quot;
22+
</pre>
23+
24+
<p><strong class="example">Example 3:</strong></p>
25+
26+
<pre>
27+
<strong>Input:</strong> s = &quot;2[abc]3[cd]ef&quot;
28+
<strong>Output:</strong> &quot;abcabccdcdcdef&quot;
29+
</pre>
30+
31+
<p>&nbsp;</p>
32+
<p><strong>Constraints:</strong></p>
33+
34+
<ul>
35+
<li><code>1 &lt;= s.length &lt;= 30</code></li>
36+
<li><code>s</code> consists of lowercase English letters, digits, and square brackets <code>&#39;[]&#39;</code>.</li>
37+
<li><code>s</code> is guaranteed to be <strong>a valid</strong> input.</li>
38+
<li>All the integers in <code>s</code> are in the range <code>[1, 300]</code>.</li>
39+
</ul>

0 commit comments

Comments
 (0)