less than 1 minute read

Given a single linked list node, representing a binary number with most significant digits first, return it as an integer.

Constraints

  • n ≤ 30 where n the number of nodes in node

https://binarysearch.com/problems/Linked-List-to-Integer

Examples

Example 1

Input

  • node =

Output

  • answer = 4

Explanation

The linked list represented 100 in binary.

Solution

Leave a comment