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 bc90a94 commit 083ff2eCopy full SHA for 083ff2e
src/main/java/com/fishercoder/solutions/_234.java
@@ -31,14 +31,14 @@ public boolean isPalindrome(ListNode head) {
31
slow = slow.next;
32
}
33
34
- ListNode reversedHead = reverse(slow.next);
+ ListNode secondHalfHead = reverse(slow.next);
35
ListNode firstHalfHead = head;
36
- while (firstHalfHead != null && reversedHead != null) {
37
- if (firstHalfHead.val != reversedHead.val) {
+ while (firstHalfHead != null && secondHalfHead != null) {
+ if (firstHalfHead.val != secondHalfHead.val) {
38
return false;
39
40
firstHalfHead = firstHalfHead.next;
41
- reversedHead = reversedHead.next;
+ secondHalfHead = secondHalfHead.next;
42
43
return true;
44
0 commit comments