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.
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.
The function should return should decimal equivalent modulo 1000000007
1 <=T<= 200
0 <=N<= 100
Data of Node is either 0 or 1
0 1 1
1 1 1 0
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.
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.