Given a singly linked list of 0s and 1s, the task is to find its decimal equivalent. Decimal Value of an empty linked list is considered as 0.
Since the answer can be very large, answer modulo 1000000007 should be printed.
First line of input contains number of testcases T. For each testcase, first line of input contains
The function should return should decimal equivalent modulo 1000000007.
The task is to complete the function decimalValue() which should find the decimal value of the given binary value in the linked list.
1 <= T <= 200
0 <= N <= 100
Data of Node is either 0 or 1
0 1 1
1 1 1 0
Testcase 1: 1*20 + 1*21 + 0*22 = 1 + 2 + 0 = 3.
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.