Beat 100% DART
\n# Code\n\nclass Solution {\n  List<int> mostVisited(int n, List<int> rounds) {\n    Map<int,int> visitSectors={};\n    for(int i=0;i<rounds.length-1;i++){\n  
\n# Code\n```\nclass Solution {\n  List<int> mostVisited(int n, List<int> rounds) {\n    Map<int,int> visitSectors={};\n    for(int i=0;i<rounds.length-1;i++){\n        if(rounds[i]<rounds[i+1]){\n            // print("${rounds[i]} to ${rounds[i+1]}");\n            for(int j=rounds[i];j<rounds[i+1];j++){\n                visitSectors[j]=(visitSectors[j]??0)+1;\n                // print(\'$j:${visitSectors[j]}\');\n            }\n        }else{\n            // print("${rounds[i]} to $n and then from 1 to ${rounds[i+1]}");\n            for(int j=rounds[i];j<=n;j++){\n                visitSectors[j]=(visitSectors[j]??0)+1;\n                // print(\'$j:${visitSectors[j]}\');\n            }\n            for(int j=1;j<rounds[i+1];j++){\n                visitSectors[j]=(visitSectors[j]??0)+1;\n            }\n        }\n        print(visitSectors);\n    }\n    visitSectors[rounds.last]=(visitSectors[rounds.last]??0)+1;\n    // print(visitSectors);\n    int maxValue = visitSectors.values.reduce((maxValue,next)=>maxValue>next?maxValue:next);\n    List<int> res = visitSectors.entries.where((entry)=>entry.value==maxValue).map((entry)=>entry.key).toList();\n    res.sort();\n    return res;\n  }\n}\n```
['Dart']