Problem Link: https://binarysearch.com/problems/Linked-List-to-Integer
This question is to transform the given linked list representing the binary number into a decimal number. For example, 1->0->0
represents 4 in decimal. This is quite a simple question. Starting from the head node, we track of the res
and multiply it by 2 and add the current value.