Pergunta de entrevista da empresa Apple

How do you reverse a string?

Respostas da entrevista

Sigiloso

23 de mar. de 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

Sigiloso

1 de abr. de 2016

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

1