Domanda di colloquio di Intel Corporation

Write a recursive Java function to reverse a String object

Risposta di colloquio

Anonimo

18 lug 2015

public String reverse(){ if ( (str==null) || str.length()<=1) ){ return str; } return reverse(str.substring(1))+str.chatAt(0); }

6