leetcodeSolution to some Leetcode problems written in C++ |
git clone git://git.dimitrijedobrota.com/leetcode.git |
Log | Files | Refs | README | LICENSE |
1290.cpp (198B)
0 class Solution { 1 public: 2 int getDecimalValue(ListNode *head) { 3 int res = 0; 4 for (; head; head = head->next) 5 res = res * 2 + head->val; 6 return res; 7 } 8 };