topic:
2562.Find the series of the array.md
Thought:
This question andquiz4very similar,都是Double pointer。
I made a mistake when I did this question,When calculating the right pointer, the negative index is calculatedright = -left + 1
,It is difficult to calculate the relationship between positive indexes,So replacedright = len(nums) - 1 - left
。
Code:
1 | class Solution: |