[java] - a more intuitive way to think of the sector
I found the sector definition is very hard to perceive:\n\n       |\n    3  |  2\n-------+-------\n    4  |  1\n       |\n\n\nA better way of definition would p
I found the sector definition is very hard to perceive:\n```\n       |\n    3  |  2\n-------+-------\n    4  |  1\n       |\n```\n\nA better way of definition would probabably be\n\n```\n       3\n       |\n       |   \n4 -----+----- 2\n       |   \n       |\n\t   1\n```\n\n1. brute force - every round from rounds[1], you elaberate all sectors visited in between, and +1 for every sector in visits[sector]++, but the time would be O(rounds * n)\n```\n  for (int i = 1; i < rounds.length(); i++)\n    int dist = (rounds[i] - rounds[i - 1] + n) % n;\n    for (int sector = rounds[i - 1]; sector < rounds[i]; sector = (sector + 1) % n)\n```\n2. ultimately, there is only 2 values in terms of visited times of any sector, `v`, and `v + 1` (the mod)\n\t - we just need to find out the mod sectors\n\n```java\nclass Solution {\n    public List<Integer> mostVisited(int n, int[] rounds) {\n        Set<Integer> extraVisited = new TreeSet<>();\n\n        int start = rounds[0];\n        int end = rounds[rounds.length - 1];\n        int extraDist = (end + n - start) % n;\n\n        for (int i = 0; i <= extraDist; i++) {\n            int s = (start - 1 + i) % n + 1;\n            extraVisited.add(s);\n        }\n\n        return new ArrayList(extraVisited);\n    }\n}\n```
[]