Sort letters by height [FINALIZED]
+0
−0
Now posted: Sort letters by height
Given a sequence of lower case letters, sort them into order of height.
Heights
The heights of letters are dependent on font, so for this challenge the height order to be used is as defined below:
acemnorsuvwxz
t
i
bdfghklpqy
j
Letters on the same line are defined to be the same height. The first line is the shortest letters, the last line is the tallest letter.
Input
- A sequence of lower case letters
- This may be a string or any data structure of characters
Output
- A sequence of the same letters in sorted order
- This may be a string or any ordered data structure of characters. It does not need to match the input format (provided it is consistent between inputs)
- For example, you may take input as an array of characters, and output as a string, provided this format does not change for different inputs
- The sort does not need to be stable (letters that are the same height do not need to remain in the same order as the input, even if the input was already sorted)
- The sort may be either ascending or descending
Test cases
Since the sort order can be either ascending or descending, and the sort does not need to be stable, most inputs will have many possible valid outputs. The test cases are in the format "input" : ["valid", "outputs"]
. You may choose any of the valid outputs, but you must output only one of them.
"a" : ["a"]
"aa" : ["aa"]
"atibj" : ["atibj", "jbita"]
"tick" : ["ctik", "kitc"]
"now" : ["now", "nwo", "onw", "own", "wno", "won"]
"just" : ["jtus", "jtsu", "sutj", "ustj"]
"pjztyix" : ["xztipyj", "zxtipyj", "xztiypj", "zxtiypj", "jypitzx", "jypitxz", "jpyitzx", "jpyitxz"]
0 comment threads