Question d’entretien chez Apple

How do you reverse a string?

Réponses aux questions d'entretien

Utilisateur anonyme

23 mars 2020

Using inbuilt function reverse() or by using for loop. E.g: String str = "Reverse a string program"; String temp =""; System.out.println ("String before reversing" +str); for (int i =str.length()-1; i>=0;i--) { temp = temp+str.charAt(i) } System.out.println("String after reverse" +temp);

1

Utilisateur anonyme

1 avr. 2016

Point at the start of the string and the end and work till you hit the middle.

1