To the Top
File:  root - text - article - 2019 - 12 - merge-list-of-number-into-ranges.txt.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 186 Views, 19476 Search Bots | 98 Words

Subscribe to Feed Burner | Browse | Archive
Hi, here's your problem today. This problem was recently asked by Facebook:

Given a sorted list of numbers, return a list of strings that represent all of the consecutive numbers.

Example:
Input: [0, 1, 2, 5, 7, 8, 9, 9, 10, 11, 15]
Output: ['0->2', '5->5', '7->11', '15->15']
Assume that all numbers will be greater than or equal to 0, and each element can repeat.

Here is a starting point:


def findRanges(nums):
# Fill this in.

print findRanges([0, 1, 2, 5, 7, 8, 9, 9, 10, 11, 15])
# ['0->2', '5->5', '7->11', '15->15']
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Cateogry: Computing | 186 Views, 19476 Search Bots | 98 Words Subscribe to Feed Burner

Related Articles

  1. [Daily Problem] Remove k-th Last Element From Linked List
  2. Algorithm Interview: Maximum Path Sum in Binary Tree
  3. A trick for getting good at coding interviews FASTER
  4. Daily Interview Problem: Sort Colors
  5. [Daily Problem] Remove Consecutive Nodes that Sum to 0
  6. Spectrum Master
  7. Spreadsheet Columns
  8. Daily Interview Problem: Decode String
  9. Kaprekar
  10. ImageMagick Vulnerabilities -  CVE-2016–3714

Comments (0)

Your Email (Domain Part Not Exposed):

Your Comments:

Privately By Mail Colors More Smileys S x y @

Verification (Click Image 2 Refresh):

    Be the first one to comment this page !


Page Edited: October 30 2020 14:21:09 | RSS Subscription
How to Cook a Perfect Steak? | <meta name="robots" content="noindex, follow" />