Domanda di colloquio di Apple

Reverse a string.

Risposta di colloquio

Anonimo

6 mar 2017

String reverse(String s) { StringBuffer sb=new StringBuffer(); for(int i=s.length(); i>=0; i--) { sb.append(s.charAt(i)); } return sb.toString(); }