C++ All you need is the front and back
Take the front and the back, then build the returning vector with those values.\n\n\nclass Solution {\n\tprivate:\n\t  vector<int> Ret;\n\tpublic:\n\t  vector<i
Take the front and the back, then build the returning vector with those values.\n\n```\nclass Solution {\n\tprivate:\n\t  vector<int> Ret;\n\tpublic:\n\t  vector<int> mostVisited(int n, vector<int>& rounds) {\n\t\tint f, b;\n\t\tf = rounds.front();\n\t\tb = rounds.back();\n\n\t\tif (f == b) {\n\t\t  Ret.push_back(f);\n\t\t  return Ret;\n\t\t}\n\t\tif (f < b)\n\t\t  for (int k = f; k <= b; ++k)\n\t\tRet.push_back(k);\n\t\telse {\n\t\t  for (int k = 1; k <= b; ++k)\n\t\tRet.push_back(k);\n\t\t  for (int k = f; k <= n; ++k)\n\t\tRet.push_back(k);\n\t\t}\n\t\treturn Ret;\n\t  }\n\t};\n```
[]