Shortest-LeetCode-Python-Solutions icon indicating copy to clipboard operation
Shortest-LeetCode-Python-Solutions copied to clipboard

用 3.8 新特性 := 可以简化一些

Open asukaminato0721 opened this issue 5 years ago • 1 comments

class Solution:
    def isPalindrome(self, x: int) -> bool:
        return (k:=str(x)) == k[::-1]

~~字符数好像还多了~~

asukaminato0721 avatar Nov 18 '20 15:11 asukaminato0721

字符数少了,而且减少计算时间√

cy69855522 avatar Dec 22 '20 09:12 cy69855522