Given the head node head of a singly linked list, where each node stores a binary digit, interpret the sequence of node values from head to the tail as a binary number and return its value in base
Note: The most significant bit is at
head.
Constraints:
The linked list is not empty.
The number of nodes in the linked list does not exceed
Each node’s value is either
Given the head node head of a singly linked list, where each node stores a binary digit, interpret the sequence of node values from head to the tail as a binary number and return its value in base
Note: The most significant bit is at
head.
Constraints:
The linked list is not empty.
The number of nodes in the linked list does not exceed
Each node’s value is either