Skip to content

Practice Convert Binary Number in a Linked List to Integer

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#1290
LeetCode Problem

Convert Binary Number in a Linked List to Integer

Problem Statement

Given head which is a reference node to a singly-linked list. The value of each node in the linked list is either 0 or 1. The linked list holds the binary representation of a number. Return the decimal value of the number in the linked list. The most significant bit is at the head of the linked list.

Source: Convert Binary Number in a Linked List to Integer on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
head = [1,0,1]
Output
5

# Example 2

Input
head = [0]
Output
0

Constraints

The Linked List is not empty.
Number of nodes will not exceed 30.
Each node's value is either 0 or 1.

Related LeetCode Problems

Practice more problems similar to Convert Binary Number in a Linked List to Integer.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.