leetcode_228. Summary Ranges ? 待解决

来源:互联网 发布:mac照片视频导出 编辑:程序博客网 时间:2024/06/03 16:01

Given a sorted integer array without duplicates, return the summary of its ranges.

Example 1:
Input: [0,1,2,4,5,7]
Output: [“0->2”,”4->5”,”7”]
Example 2:
Input: [0,2,3,4,6,8,9]
Output: [“0”,”2->4”,”6”,”8->9”]

提示:提交代码后,需要用简洁的语言解释一下代码思路~ 谢谢

历史题目和总结见公众号「每日一道算法题」

https://leetcode.com/problems/summary-ranges/description/

思路