6 kyu
Sort the comments!
268danarters
Description:
Background
One way to order a nested (reddit-style) commenting system is by giving each comment a rank.
Generic comments on a thread start with rank 1 and increment, so the second comment on a thread would have rank 2. A reply to comment 1 will be ranked 1.1, and a reply to comment 1.1 will be ranked 1.1.1 . The second comment to reply to comment 1 would be ranked 1.2 .
Note that since 1.1.1 is a valid rank, the ranks given are of type string.
Task:
Given a list of comment ranks (strings), order them as a comment thread would appear
Assumptions:
- there will always be a rank 1 in the given input
- ranks are of type string
- rank numbers are incremented, and not skippped (1.1 could be followed by 1.2, not 1.3)
Example order:
[
'1',
'1.1',
'1.2',
'1.2.1',
'2',
'3',
'3.1',
'3.1.1',
'3.2'
]
Sorting
Algorithms
Similar Kata:
Stats:
Created | Feb 12, 2017 |
Published | Feb 12, 2017 |
Warriors Trained | 729 |
Total Skips | 19 |
Total Code Submissions | 1432 |
Total Times Completed | 268 |
Python Completions | 268 |
Total Stars | 29 |
% of votes with a positive feedback rating | 93% of 92 |
Total "Very Satisfied" Votes | 82 |
Total "Somewhat Satisfied" Votes | 7 |
Total "Not Satisfied" Votes | 3 |
Total Rank Assessments | 12 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 7 kyu |