Here is the question given by Uber interview -
/**
- Write a comparator that takes two strings and returns a standard integer value:
-
something negative if the first string is "smaller,"
-
zero if they are "equal,"
-
and something positive if the first string is "larger."
- We want to agree with the standard comparator for all cases except one:
- if we encounter a consecutive string of integers, we want to read it for its numeric value,
- and use that as the comparison.
- For instance, in the standard string comparator, "a1b" comes before "a10b", because 'a' == 'a' and '1' < '10'.
- In our string ordering, I want to reverse this, instead parsing it so that we see 'a' == 'a', but 10 > 2.
*/