Given a singly linked list of 0s and 1s find its decimal equivalent

```
Input : 0->0->0->1->1->0->0->1->0
Output : 50
```

Decimal Value of an empty linked list is considered as 0.

Since the answer can be very large, **answer modulo 1000000007** should be printed.

**Input:**

The task is to complete the method which takes one argument: the head of the linked list. The struct Node has a data part which stores the data and a next pointer which points to the next element of the linked list.

There are multiple test cases. For each test case, this method will be called individually.

**Output:**

The function should return should decimal equivalent modulo 1000000007

**Constraints:**

1 <=T<= 200

0 <=N<= 100

Data of Node is either 0 or 1

**Example:
Input:**

2

3

0 1 1

4

1 1 1 0

**Output:**

3

14

**Note:**The **Input/Ouput** format and **Example** given are used for system's internal purpose, and should be used by a user for **Expected Output** only. As it is a function problem, hence a user should not read any input from stdin/console. The task is to complete the function specified, and not to write the full code.

Author: kartik

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

thanuvinu94 | 238 |

the_coder95 | 215 |

ShivayLamba | 208 |

sandeep.prajapati | 129 |

Ashish Kumar Vaishy | 114 |

the_coder95 | 1441 |

RishabhTanwar1 | 1110 |

thanuvinu94 | 914 |

tathagat289 | 668 |

themanhasnoname | 620 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4897 |

Quandray | 4547 |

Login to report an issue on this page.