We are given a list of alpha numeic Events and we need to check if it is sorted or not
Anonymous User
211

We are given a list of alpha numeic Events and we need to check if it is sorted or not ?
An event can either contain a letter (alpha), an hyphen '-' (should be considered as alpha and not negative) or a number.

All the alpha(including '-') should be sorted before number.
Two alpha should be sorted in natural order
Series of numbers should be collected and compared like abc123 and abc456 is in sorted order because 123 < 456
If two numbers are same value, one with smaller length should be sorted first.
Ensure handle number correctly like abc122axy99z have two numbers 122 and 99. Also number can be padded wuth zeroes. if two numbers are same value, one with smaller length should be sorted first.

Example sorting order:

abc is sorted before 123
123 is sorted before 456
954 is sorted before 01234
abz is sorted before axy

Test Input:
["abc123hij-k","abc123hij-k","abc456hij-k","abc954hij-k","abc01234hij-k","xyz123hij-k","x123hij-k","21030003020"]

Comments (0)