Given an unsorted array of integers, return an array of strings where each string indicates the start and end of a subsequence of consecutive integers. Example: Input = [6, 3, 4, 9, 2, 7], Output = ["2->4", "6->7", "9"]
Asked in the phone interview stage. Given directly as the phone interview coding question for an Experienced Mobile Engineer role.
Implement summarize_ranges(nums). Return ranges in ascending order. A range containing one integer is represented by that integer alone. Duplicate values should appear only once.
Example: nums = [1, 2, 4, 5, 7] returns ["1->2", "4->5", "7"].
Constraints: 0 <= len(nums) <= 1000; values are integers.
def summarize_ranges(nums):