Re: [闲聊] 每日LeetCode

楼主: Rushia (みけねこ的鼻屎)   2023-06-12 16:50:01
https://leetcode.com/problems/summary-ranges/description/
228. Summary Ranges
给你一个有序整数阵列,如果相邻的元素是连续的将他们合并,例如:[1,2,3] ==>
[1,3],并把合并过的阵列 [a,b] 依照下列格式转成字串:
"a->b" if a != b
"a" if a == b
Example 1:
Input: nums = [0,1,2,4,5,7]
Output: ["0->2","4->5","7"]
Explanation: The ranges are:
[0,2]
作者: JIWP (JIWP)   2023-06-12 16:53:00
大师

Links booklink

Contact Us: admin [ a t ] ucptt.com