Given a singly linked list of N nodes.
The task is to find the middle of the linked list. For example, if the linked list is 1-> 2->3->4->5,then the middle node of the list is 3.
If there are two middle nodes(in case, when N is even), print the second middle element.
For example, if the linked list given is 1->2->3->4->5->6, then the middle node of the list is 4.
Middle of linked list is 3.
Middle of linked list is 7.
The task is to complete the functiongetMiddle() which takes a head reference as the only argument and should return the data at the middle node of the linked list.
Expected Time Complexity: O(N). Expected Auxiliary Space: O(1).