leetcode [#234] | GCidea's blog
目录1. 题目2. 解决方案3. 注意事项
题目Given a singly linked list, determine if it is a palindrome.
解决方案1234567891011121314151617181920212223242526272829303132/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */public class Solution { public boolean isPalindrome(ListNode head) { boolean result = true; if(head == null) return result; ListNode p = head; List<Integer> list = new Arr...阅读全文
题目Given a singly linked list, determine if it is a palindrome.
解决方案1234567891011121314151617181920212223242526272829303132/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */public class Solution { public boolean isPalindrome(ListNode head) { boolean result = true; if(head == null) return result; ListNode p = head; List<Integer> list = new Arr...阅读全文