diff --git a/python /2390 - Removing Stars From a String.py b/python /2390 - Removing Stars From a String.py new file mode 100644 index 000000000..c27c8c004 --- /dev/null +++ b/python /2390 - Removing Stars From a String.py @@ -0,0 +1,10 @@ +# https://leetcode.com/problems/removing-stars-from-a-string/submissions/1011668695/ +class Solution(object) : + def removeStars(self, s) : + res = [] + for c in s : + if res and c == '*': + res.pop() + else: + res.append(c) + return ''.join(res)