Definition at line 18 of file main.cpp.
◆ isPalindrome()
| bool Solution::isPalindrome |
( |
ListNode * |
head | ) |
|
|
inline |
Definition at line 21 of file main.cpp.
22 {
24 deque<ListNode*> queue;
25 while (ptr != NULL)
26 {
27 queue.push_back(ptr);
29 }
30
31
32 while (!queue.empty())
33 {
34
37 if (upper == lower)
38 return true;
39
40
41 if (upper->
val != lower->
val)
42 return false;
43
44 queue.pop_front();
45 queue.pop_back();
46 }
47 return true;
48 }
Definition for singly-linked list.
References ListNode::next, and ListNode::val.
Referenced by main().
The documentation for this class was generated from the following file: