Uber | OA | Implement a string comparator

Hi there, I interviewed today for Sr. Android Engineer at Uber. Here is the excercise that I was asked to implement:

Implement a string comparator that will take into account numeric value of number in the string
Output should follow the standard comparator format:

Return -1 if the first parameter is smaller than the second parameter
Return 0 if both parameters are equal
Return 1 if the first parameter is grater than the second parameter

Comments (0)