https://leetcode.com/problems/palindrome-linked-list/ https://www.geeksforgeeks.org/function-to-check-if-a-singly-linked-list-is-palindrome/ Given a singly linked list, determine if it is a palindrome. Example 1: Input: 1->2 Output: false Example 2: Input: 1->2->2->1 Output: true...
Linked List | Set 1 (Introduction) - GeeksforGeeks)
http://www.geeksforgeeks.org/function-to-check-if-a-singly-linked-list-is-palindrome/ 这里的reverse可以reverse整个list,这样空间需求就是O(n),不如这个网页写的O(1)的方法 1#include <iostream>2#include <vector>3#include <algorithm>4#include <queue>5#include <stack>6#include <string>7#include...