Link: https://leetcode.com/problems/faulty-keyboard/description/ ## Code ```python= class Solution: def finalString(self, s: str) -> str: flipped = False ans = deque() for ch in s: if ch == 'i': flipped = not flipped elif flipped: ans.appendleft(ch) else: ans.append(ch) if flipped: return "".join(ans)[::-1] else: return "".join(ans) ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up