```
class Solution:
# @param {integer[]} nums
# @return {string[]}
def summaryRanges(self, nums):
result = []
if not nums: return result
start = current = None
for num in nums:
if start == None:
start = current = num
elif num == current + 1:
current = num
else:
result.append(self.generateStringRange(start, current))
start = current = num
result.append(self.generateStringRange(start, current))
return result
def generateStringRange(self, start, end):
result = str(start)
if start != end: result += "->" + str(end)
return result
```