1290. 二进制链表转整数
int getDecimalValue(struct ListNode* head){ int res = 0; while (head) { res <<= 1; res += head->val; head = head->next; } return res; }
Please call me JiangYouDang!
int getDecimalValue(struct ListNode* head){ int res = 0; while (head) { res <<= 1; res += head->val; head = head->next; } return res; }