🟢 剑指 Offer 57. 和为s的两个数字
LeetCode 提示
题目难度 简单
原题链接 🔗 leetcode
#
题解 1_偷瞄了.pyclass Solution: def findContinuousSequence(self, target: int) -> List[List[int]]: l, r, s = 1, 2, 3 res = [] while l < r: if s == target: res.append(list(range(l, r+1))) s -= l l += 1 if s < target: r += 1 s += r elif s > target: s -= l l += 1 return res