Java 2ms beats 84%, uses nested loops to simulate the marathon and count the sector visits
\nclass Solution {\n  public List<Integer> mostVisited(int n, int[] rounds) {\n    \n    /*\n    Runtime: 2 ms, faster than 83.87% of Java online submissions fo
```\nclass Solution {\n  public List<Integer> mostVisited(int n, int[] rounds) {\n    \n    /*\n    Runtime: 2 ms, faster than 83.87% of Java online submissions for Most Visited Sector in a Circular Track.\n    Memory Usage: 39.6 MB, less than 90.26% of Java online submissions for Most Visited Sector in a Circular Track.\n    */\n\n    int[] sectorVisitationCounter = new int[n + 1]; // this int[] is 1-indexed to match the sectors numbered 1--n\n\n    ++sectorVisitationCounter[rounds[0]]; // increment the very first starting sector now,\n\t// outside the nested loops below, since inside the loops the logic is to\n\t// increment the counter when we land on it, and for this very first sector\n\t// we don\'t land on it from anyplace, so it\'s special\n\n    for (int curRound = 0; curRound < rounds.length - 1; ++curRound) {\n\n      int startSector = rounds[curRound];\n      int endSector = rounds[curRound + 1];\n\n      int curSector = startSector;\n\n      while (curSector != endSector) {\n        ++curSector;\n        if (curSector > n) { // wrap around\n          curSector = 1;\n        }\n\n        ++sectorVisitationCounter[curSector];\n      }\n    }\n\n    // determine the greatest value in sectorVisitationCounter[]\n    int greatestValue = 0;\n    for (int i : sectorVisitationCounter) {\n      greatestValue = Math.max(greatestValue, i);\n    }\n\n    // now determine which sector(s) were visited a greatestValue number of times\n    List<Integer> result = new ArrayList<>();\n    for (int i = 1; i < sectorVisitationCounter.length; ++i) {\n      if (sectorVisitationCounter[i] == greatestValue) {\n        result.add(i);\n      }\n    }\n\n    return result;\n  }\n}\n```
[]