Given a singly linked list and a number k. Write a function to find the (N/k)th element, where N is the number of elements in the list. We need to consider ceil value in case of decimals.
The first line of input contains an integer T denoting the number of test cases. The first line of each test case consists of an integer N. The second line consists of N spaced integers.The last line consists of an integer k.
Print the data value of (N/k)th node in the Linked List.
The task is to complete the function fractional_node() which should find the n/kth node in the linked list and return its data value.
1 <= T <= 100
1 <= N <= 100
1 2 3 4 5 6
2 7 9 3 5
Testcase 1: 6/2th element is the 3rd(1-based indexing) element which is 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.