Skip to content

1290. Convert Binary Number in a Linked List to Integer #1926

Answered by mah-shamim
mah-shamim asked this question in Q&A
Discussion options

You must be logged in to vote

We need to convert a binary number represented as a singly-linked list into its decimal equivalent. Each node in the linked list contains a bit (0 or 1), with the head node being the most significant bit. The solution involves traversing the linked list and efficiently computing the decimal value using bit manipulation.

Approach

  1. Problem Analysis: The linked list represents a binary number where each node is a bit. The head is the most significant bit, and subsequent nodes follow in decreasing order of significance. The task is to convert this binary number into a decimal integer.
  2. Intuition: As we traverse the linked list from the head to the tail, each new bit encountered is the next lea…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@topugit
Comment options

topugit Jul 14, 2025
Collaborator

@mah-shamim
Comment options

mah-shamim Jul 14, 2025
Maintainer Author

Answer selected by topugit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested easy Difficulty
2 participants