Leetle #7 X/6 16:53
π₯π©π₯π©π₯π©
π₯π©π©π©π₯π₯
π©π©π©π©π©π₯
π©π©π©π©π©π₯
π₯π©π₯π©π₯π©
π₯π©π₯π©π₯π₯
terrible. was trying to keep the logic to more-or-less one line lol. took two more tries after this and an interpreter to get the and clause right but i got there with this monstrosity
![Python code:
def solve(s):
st = []
try:
return all(t := [y for y in [(st.append({"(": ")", "[": "]", "{": "}"}[x]) if x in "{([" else st.pop() == x) for x in s] if y is not None]) and (bool(len(t)) or not(s))
except Exception:
return False Python code:
def solve(s):
st = []
try:
return all(t := [y for y in [(st.append({"(": ")", "[": "]", "{": "}"}[x]) if x in "{([" else st.pop() == x) for x in s] if y is not None]) and (bool(len(t)) or not(s))
except Exception:
return False](https://cdn.bsky.app/img/feed_thumbnail/plain/did:plc:3aiguoirj6d7junactldeeos/bafkreienol53vpzxhfjnuzql6ybuqnyyvrus5hitqfe7hkggx27cikhcry)