@Test public void shouldReverseStringIterative() { String result = reverseString.reverseIterative("Pedro"); assertEquals("ordeP", result); }
public String reverseIterative(String input) { validateInput(input); StringBuilder stringBuilder = new StringBuilder(); for (int i = input.length() - 1; i >= 0; i--) { stringBuilder.append(input.charAt(i)); } return stringBuilder.toString(); }
ReverseString { public String reverseIterative(String input) { validateInput(input); StringBuilder stringBuilder = new StringBuilder(); for (int i = input.length() - 1; i >= 0; i--) { stringBuilder.append(input.charAt(i)); } return stringBuilder.toString(); } }
ReverseString { public String reverseIterative(String input) { validateInput(input); StringBuilder stringBuilder = new StringBuilder(); for (int i = input.length() - 1; i >= 0; i--) { stringBuilder.append(input.charAt(i)); } return stringBuilder.toString(); }  }
ReverseString { public String reverseIterative(String input) { validateInput(input); StringBuilder stringBuilder = new StringBuilder(); for (int i = input.length() - 1; i >= 0; i--) { stringBuilder.append(input.charAt(i)); } return stringBuilder.toString(); }  String reverseIterative(String input); String reverseRecursive(String input); }
ReverseString { public String reverseIterative(String input) { validateInput(input); StringBuilder stringBuilder = new StringBuilder(); for (int i = input.length() - 1; i >= 0; i--) { stringBuilder.append(input.charAt(i)); } return stringBuilder.toString(); }  String reverseIterative(String input); String reverseRecursive(String input);  }