Sort Topic Names by Prefix and Numeric Suffix

Problem

Given a list of topic names, each formatted as alphabetic_prefix_nonnegative_integer, such as aaa_2 and aaa_10, return the names in sorted order.

Apply these rules:

  1. Sort prefixes ...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: