HCLTech interview question

String reversal in java