/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* struct ListNode *next;
* };
*/
/**
* Note: The returned array must be malloced, assume caller calls free().
*/
int* nextLargerNodes(struct ListNode* head, int* returnSize){
int* ans=(int*)calloc(10000,sizeof(int));
*returnSize=0;
struct ListNode* head1;
while(head){
head1=head;
int flag=0;
while(head1){
head1=head1->next;
if(head1!=NULL&&head->val<head1->val){
ans[*returnSize]=head1->val;
*returnSize=*returnSize+1;
flag=1;
break;
}
}
if(flag==0){
ans[*returnSize]=0;
*returnSize=*returnSize+1;
}
head=head->next;
}
return ans;
}
07-06
196
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
05-10
584
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
04-14
206
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
04-24
1845
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
07-02
382
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)