解题思路:2次幂
class Solution {
public int getDecimalValue(ListNode head) {
int result =0;
while(head!=null){
result = head.val + (result <<1);
head = head.next;
}
return result ;
}
}
解题思路:2次幂
class Solution {
public int getDecimalValue(ListNode head) {
int result =0;
while(head!=null){
result = head.val + (result <<1);
head = head.next;
}
return result ;
}
}