Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9703a71

Browse files
refactor 394
1 parent9ea3662 commit9703a71

File tree

1 file changed

+16
-0
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+16
-0
lines changed

‎src/main/java/com/fishercoder/solutions/_394.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@
22

33
importjava.util.Stack;
44

5+
/**394. Decode String
6+
*
7+
* Given an encoded string, return it's decoded string.
8+
* The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times.
9+
* Note that k is guaranteed to be a positive integer.
10+
* You may assume that the input string is always valid;
11+
* No extra white spaces, square brackets are well-formed, etc.
12+
* Furthermore, you may assume that the original data does not contain any digits and
13+
* that digits are only for those repeat numbers, k. For example, there won't be input like 3a or 2[4].
14+
*
15+
* Examples:
16+
* s = "3[a]2[bc]", return "aaabcbc".
17+
* s = "3[a2[c]]", return "accaccacc".
18+
* s = "2[abc]3[cd]ef", return "abcabccdcdcdef".
19+
* */
20+
521
publicclass_394 {
622

723
publicstaticclassSolution1 {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp