|
A sequence of numbers, such as: 1, 2, 3, 5, 7, 8, 9
The program is required to complete such functions, read this number sequence in a loop, and form this number sequence into a string. The format is required: "1-3,5,7-9". That is, the increasing number sequence is in nm Performance, otherwise it is expressed as n, m.
Is there any good algorithm ?! C # |
|