Skip to main content

2810. Faulty Keyboard - LeetCode

ยท One min read
class Solution:
def finalString(self, s: str) -> str:
buf = []
for c in s:
if c == 'i':
buf = buf[::-1]
else:
buf.append(c)
return ''.join(buf)