bool solve(struct ListNode** hd, struct ListNode* tl) {
if(tl == NULL)
{
return true;
}
bool flag = solve(hd, tl->next);//递归到最后
if(flag == false) {
return false;
}
if(tl->val != (*hd)->val) {
return false;
}
(*hd) = (*hd)->next;
return flag;
}
bool isPalindrome(struct ListNode* head){
return solve(&head, head);
}
回文链表的递归判断?为啥solve传过去的事&head,链表存在传值和传址操作吗?传过去&head和head有啥区别?