int* printListFromTailToHead(struct ListNode* listNode, int* returnSize ) { // write code here int* res=(int*)malloc(sizeof(int)*10000); int i=0; struct ListNode* node=listNode; while(node){ res[i++]=node->val; node=node->next; } *returnSize=i; for(int j=0;j<i/2;j++){ int temp=res[j]; res[j]=res[i-j-1]; res[i-j-1]=temp; } return res; }