int getDecimalValue(struct ListNode* head){ int ans=0; struct ListNode* cur=head; while(cur){ ans=ans*2+cur->val; cur=cur->next; } return ans; }