Skip to content

Improved task 3612 #2016

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,53 +21,13 @@ Return the final string `result` after processing all characters in `s`.

**Explanation:**

`i`

`s[i]`

Operation

Current `result`

0

`'a'`

Append `'a'`

`"a"`

1

`'#'`

Duplicate `result`

`"aa"`

2

`'b'`

Append `'b'`

`"aab"`

3

`'%'`

Reverse `result`

`"baa"`

4

`'*'`

Remove the last character

`"ba"`
| i | s[i] | Operation | Current `result` |
|---|-------|----------------------------|------------------|
| 0 | `'a'` | Append `'a'` | `"a"` |
| 1 | `'#'` | Duplicate `result` | `"aa"` |
| 2 | `'b'` | Append `'b'` | `"aab"` |
| 3 | `'%'` | Reverse `result` | `"baa"` |
| 4 | `'*'` | Remove the last character | `"ba"` |

Thus, the final `result` is `"ba"`.

Expand All @@ -79,37 +39,11 @@ Thus, the final `result` is `"ba"`.

**Explanation:**

`i`

`s[i]`

Operation

Current `result`

0

`'z'`

Append `'z'`

`"z"`

1

`'*'`

Remove the last character

`""`

2

`'#'`

Duplicate the string

`""`
| i | s[i] | Operation | Current `result` |
|---|-------|---------------------------|------------------|
| 0 | `'z'` | Append `'z'` | `"z"` |
| 1 | `'*'` | Remove the last character | `""` |
| 2 | `'#'` | Duplicate the string | `""` |

Thus, the final `result` is `""`.

Expand Down
Loading