【leetcode】1290. 二进制链表转整数
int getDecimalValue(struct ListNode* head){ int ans=0; struct ListNode* cur=head; while(cur){ ans=ans*2+cur->val; cur=cur->next; } return ans; }
int getDecimalValue(struct ListNode* head){ int ans=0; struct ListNode* cur=head; while(cur){ ans=ans*2+cur->val; cur=cur->next; } return ans; }