We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4d939c3 commit e091e22Copy full SHA for e091e22
src/main/java/com/thealgorithms/strings/ReverseString.java
@@ -66,6 +66,7 @@ public static String reverse3(String string) {
66
* and then pops them off to create the reversed string.
67
*/
68
public static String reverse4(String str) {
69
+ // Check if the input string is null
70
if (str == null) {
71
throw new IllegalArgumentException("Input string cannot be null");
72
}
@@ -85,4 +86,4 @@ public static String reverse4(String str) {
85
86
87
return reversedString.toString();
88
-}
89
+}
0 commit comments