C# - Counting visits
csharp\npublic IList<int> MostVisited(int n, int[] rounds) \n{\n\tint[] frequency = new int[n + 1];\n\n\tfrequency[rounds[0]]++;\n\n\tfor(int i = 1; i < rounds.
```csharp\npublic IList<int> MostVisited(int n, int[] rounds) \n{\n\tint[] frequency = new int[n + 1];\n\n\tfrequency[rounds[0]]++;\n\n\tfor(int i = 1; i < rounds.Length; i++)\n\t{\n\t\tint start = rounds[i - 1] + 1;\n\t\tint end = rounds[i];\n\n\t\twhile(start != end)\n\t\t{\n\t\t\tif(start > n)\n\t\t\t{\n\t\t\t\tstart = 1;\n\t\t\t\tif(end == 1)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfrequency[start]++;\n\t\t\tstart++;\n\t\t}\n\n\t\tfrequency[end]++;\n\t}\n\n\n\tint max = frequency.Max();\n\tList<int> result = new List<int>();\n\n\tfor(int i = 1; i < frequency.Length; i++)\n\t{\n\t\tif(frequency[i] == max)\n\t\t{\n\t\t\tresult.Add(i);\n\t\t}\n\t}\n\n\treturn result;\n}\n```
[]