[JavaScript] Math Problem O(N)
What we only consider is the start point and end point. That is, no matter how many circle we have run, the points between [start, end] are always the answer. (
What we only consider is the start point and end point. That is, no matter how many circle we have run, the points between `[start, end]` are always the answer. (You can try to draw on the paper)\n\nIf `n = 9`,\n1. `start = 3, end = 6`, output is `[3,4,5,6]`;\n2. `start = 8, end = 2`, output is `[1,2,8,9]`;\n\nTherefore, the time complexity could be not larger than O(N) (to O(1) based on how you provide data into output)\n\n```\nvar mostVisited = function(n, rounds) {\n    const start = rounds[0], end = rounds[rounds.length-1];\n    if (end >= start) {\n        const res = new Array(end-start+1);\n        for (let i = 0; i < res.length; i++) {\n            res[i] = start + i;\n        }\n        return res;\n    } else {\n        const res = new Array(end + n - start + 1);\n        let i = 0;\n        for (; i < end; i++) {\n            res[i] = i+1;\n        }\n        for (let j = 0; i < res.length; i++) {\n            res[i] = start + j++;\n        }\n        \n        return res;\n    }\n};\n```
['Math', 'JavaScript']