Removing Stars From a String - LeetCode
class Solution:
def removeStars(self, s: str) -> str:
s = list(s)
q= []
for i in s:
if i =='*':
q.pop()
else: q.append(i)
res=''
for j in q:
res+=(j)
return res
더 간단하게 하는 방법이 있을까??
<남의 풀이에서 배운 점: 리턴 간단하게 하는 법!>
return "".join(q)
''.join(리스트이름)
공백 없는 문자열로 합치기
' ' 안에 뭔가를 넣어서 한 칸씩 띄우거나 구분자를 추가할 수도 있다.