搜狐第二题
笔试算法第二题,Leetcode 原题 # 745class Solution: def reachNumber(self, target): target = abs(target) k = 0 while target > 0: k += 1 target -= k return k if target % 2 == 0 else k + 1 + k % 2 target = int(input()) s = Solution() print(s.reachNumber(target))
#搜狐#