We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e03c7cd commit cf6eac1Copy full SHA for cf6eac1
src/main/java/com/thealgorithms/strings/ReverseString.java
@@ -76,14 +76,13 @@ public static String reverse4(String str) {
76
return str;
77
}
78
// Push each character of the string onto the stack
79
- for (char i : str.toCharArray()) {
80
- stack.push(i);
+ for (char ch : str.toCharArray()) {
+ stack.push(ch);
81
82
// Pop each character from the stack and append to the StringBuilder
83
while (!stack.isEmpty()) {
84
reversedString.append(stack.pop());
85
86
return reversedString.toString();
87
88
-
89
0 commit comments