C++ | Circular Linked List | Easy and intuitive approach
Intuition\nThe first thought to the question were recognising that this question involves a cyclic event where the ball goes from 0 to n-1 and then again comes 
# Intuition\nThe first thought to the question were recognising that this question involves a cyclic event where the ball goes from 0 to n-1 and then again comes back to 0. This led me to the idea of using Circular Linked List.\n\n# Approach\nSince the question says that there is a reversal of the passing order. So if there is a cirular linked list which has the head at 0, the starting point and goes to n-1 and then form n-1 comes back to 1 which would be the last node. Now, if we connect the node 1 to head we get our circular linked list representing the flow of passing.\n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(n)\n\n# Code\n```\nclass Solution {\npublic:\n    int numberOfChild(int n, int k) {\n        ListNode* head = new ListNode;\n        ListNode* curr = head;\n        for(int i=1;i<=n-1;i++) {\n            curr->next = new ListNode(i);\n            curr = curr->next;\n        }\n        for(int i=n-2;i>0;i--) {\n            curr->next = new ListNode(i);\n            curr = curr->next;\n        }\n        curr->next = head;\n        curr = head;\n        while(k--) {\n            curr = curr->next;\n        }\n        return curr->val;\n    }\n};\n```
['Linked List', 'C++']