Back to course home
0% completed
Problem 8: Removing Stars From a String (medium)
Problem Statement
Given a string s
, where *
represents a star. We can remove a star along with its closest non-star character to its left in a single operation.
The task is to perform as many such operations as possible until all stars have been removed and return the resultant string.
Examples
Example 1
- Input:
"abc*de*f"
- Expected Output:
"abdf"
- Description: We remove
c
along with*
to get"abde*f"
, then removee
along with*
to get"abdf"
Example 2
- Input:
"a*b*c*d"
- Expected Output:
"d"
- Description: We remove
a
along with `*
.....
.....
.....
Like the course? Get enrolled and start learning!
Table of Contents
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible