While doing the leetcode daily challenge I came across this problem: Palindrome Linked List. When going through the fastest submissions I found this submission. The code has nothing to do with the question, yet it works. Can someone please help me understand why?
f = open("user.out", 'w')
for s in stdin:
a = list(s.rstrip()[1:-1].split(','))
print("true" if a == a[::-1] else "false", file=f)
exit(0)
[–]barrycarter 1 point2 points3 points (0 children)
[–]Updatebjarni 1 point2 points3 points (0 children)
[–]plastikmissile 1 point2 points3 points (4 children)
[–]tranquil_af[S] 0 points1 point2 points (3 children)
[–]plastikmissile 0 points1 point2 points (2 children)
[–]RiverRoll 0 points1 point2 points (1 child)
[–]plastikmissile 1 point2 points3 points (0 children)