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 a163816 commit f68aba0Copy full SHA for f68aba0
src/main/java/com/thealgorithms/strings/Palindrome.java
@@ -56,3 +56,22 @@ public static boolean isPalindromeTwoPointer(String s) {
56
return true;
57
}
58
59
+
60
+/**
61
+*check if string is palindrome or not
62
+*
63
+* @param s a string to check
64
+* @return {@code true} if given string is palindrome, otherwise
65
+* {@code false}
66
+*/
67
+public static boolean isPalindromeTwoPointerwhileloop(String s){
68
+ char[] charArray = word.to char Array();
69
+ int start=0; int end= s.length-1;
70
+ while(start<end){
71
+ if (char Array[start]!= char Array[end]){
72
+ return false;
73
+ }
74
+ start++; end--;
75
76
+ return true;
77
+}
0 commit comments