[C++] Solution Explained First and Last Element
There are 2 cases:\n\n##### 1.   if start <= end\nExample 1: \n \n n = 7  and  array = [1, 3, 5, 1, 2, 3]\n\t\t\t\t1  2  3  4  5  6  7              --1st circle
There are 2 cases:\n\n##### 1.   if start <= end\n**Example 1: **\n ```\n n = 7  and  array = [1, 3, 5, 1, 2, 3]\n\t\t\t\t1  2  3  4  5  6  7              --1st circle\n\t\t\t\t1  2  3                              --2nd circle\n```\n\t\t\tNote: in this case ans will be [1, 2, 3] which are being repeated twice. i. e. range array[start] to array[end]\n\t\t\tans = [1,2,3]\n**Example 2:**\n```\n\t\t\tn = 2 and array = [2, 1, 2, 1, 2, 1, 2]\n\t\t\t\t2\n\t\t\t\t1  2\n\t\t\t\t1  2\n\t\t\t\t1  2\n```\n\t\t\tNote: array[start] == array[end] so the ans is [2]\n\t\t\tans = [2]\n\n##### 2. if start > end\n**Example 1**\n```\n\t\t\tn = 2 and array = [2, 1, 2, 1, 2, 1]\n\t\t\t\t\t 2\n\t\t\t\t 1  2\n\t\t\t\t 1  2\n\t\t\t\t 1\n```\n\t\t\tNote: ans = [1 to array[end], array[start] to n]\tin this case 1 to array[end]: [1]\n\t\t\tand array[start] to n: [2]\n\t\t\tans = [1,2]\n**Example 2**\n```\t\t\tn = 5 and array = [3, 1, 3, 1]\n\t\t\t\t\t\t 3  4  5\n\t\t\t\t 1  2  3  4  5\n\t\t\t\t 1\n```\n\t\t\t Note: ans = 1 to array[end]  --->   [1] +\n\t\t\tarray[start] to n ---->  [3, 4, 5]\t\t\t\t\t\n\t\t\tans = [1, 3, 4, 5]\n\n\n**Solution:**\n```\nclass Solution {\npublic:\n    vector<int> mostVisited(int n, vector<int>& rounds) {\n        vector <int> ans;\n        int size = rounds.size();\n        \n        if(rounds[0] <= rounds[size-1]) {\n            for(int i=rounds[0]; i<= rounds[size-1]; i++) {\n                ans.push_back(i);\n            }\n            return ans;\n        }\n        else {\n            for(int i=1; i<= rounds[size-1]; i++) {\n                ans.push_back(i);\n            }   \n            \n            for(int i=rounds[0]; i<=n; i++) {\n                ans.push_back(i);\n            }\n        }\n        \n        return ans;\n    }\n};\n```\n\t\t
['C']