Leetcode Flashcards
1
A
class Solution: def converter(self, n: int, x: int): res = "" while n: res += str(n%x) n //= x return res[::-1] def isStrictlyPalindromic(self, n: int) -> bool: return all(self.converter(n,i) == self.converter(n,i)[::-1] for i in range(2,n-1))
2
A
class Solution: def xorOperation(self, n: int, start: int) -> int: result = 0 for i in range(n): tmp = start + 2*i result = result ^ tmp return result