Parsing alien numerals and sorting by custom keys in C++
This medium-difficulty coding problem tests your ability to parse a custom numeral system, implement a comparison function with multiple sort criteria, and handle edge cases in string manipulation. It is representative of problems used to evaluate practical coding skill and attention to specification detail.
The core challenge is twofold: first, reliably extract and decode the Sylvhi glyph-numeral that sits at the end of each call-sign (after the final space), applying the subtractive rule whenever a lower-value glyph precedes a higher-value one. Second, implement a stable comparator that sorts primarily by decoded numeral value, then lexicographically by the full call-sign string when values tie. A clean solution isolates the parsing logic, handles the glyph-value map clearly, and uses the standard library's sort with a well-defined comparison predicate.
- Custom numeral system decoding with conditional sign rules
- String tokenization and extraction
- Multi-key sorting and tie-breaking
- Comparator design for
std::sort