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 bb202c6 commit f4bf113Copy full SHA for f4bf113
0876_Middle_of_LL.java
@@ -0,0 +1,26 @@
1
+/**
2
+ * Definition for singly-linked list.
3
+ * public class ListNode {
4
+ * int val;
5
+ * ListNode next;
6
+ * ListNode() {}
7
+ * ListNode(int val) { this.val = val; }
8
+ * ListNode(int val, ListNode next) { this.val = val; this.next = next; }
9
+ * }
10
+ */
11
+
12
+class Solution {
13
+ public boolean isPalindrome(ListNode head) {
14
+ ListNode slow = head;
15
+ ListNode fast = head;
16
17
+ while(fast!=null && fast.next !=null){
18
+ slow = slow.next;
19
+ fast = fast.next.next;
20
21
+ }
22
+ return slow;
23
24
25
26
+}
0 commit comments