Pergunta de entrevista da empresa Dimentrix

Reverse words in a given string by word. reverse by recurssion again they asked to do reverse string with reverse word again they asked to do reverse only string not word i write all code proper but still not accepted

Resposta da entrevista

Sigiloso

15 de fev. de 2019

import java.util.*; class reverseString { public static String reverseString(String str) { if (str.isEmpty()) return str; return reverseString(str.substring(1))+str.charAt(0); } public static void main(String[] args) { String str; Scanner scanner = new Scanner(System.in); str = scanner.nextLine(); scanner.close(); System.out.println(reverseString(str)); } }

1