Uber interview question

String manipulation, recursive, complex calculations