✅ Simple Python Solution with explanation - lowest maximum distance between numbers
Intuition\n1. Identify a number say 5, compute the maximum distance between occurences of 5. E.g. 1,3,5,2,3,4,5,3,2,5,3 has a maximum distance of 4, since 5 occ
# Intuition\n1. Identify a number say 5, compute the maximum distance between occurences of 5. E.g. 1,3,5,2,3,4,5,3,2,5,3 has a maximum distance of 4, since 5 occurs at index 2,6,9 and the distance between indices 2 and 6 is the largest. \n2. Look for the number with the lowest maximum distance - this will be the number we use to flip every number to.\n3. Since you can flip the number in 2 directions, the number of times can be derived from maximum distance / 2.\n\n# Approach\n1. Use `max_dist` as a dict with the key being the number, and the value being the maximum distance.\n2. Once we identify the `max_dist` for all numbers, we look for the number with the lowest `max_dist`.\n3. Return `max_dist//2` for this number.\n\n# Complexity\n- Time complexity: O(N)\n- Space complexity: O(N)\n\n# Code\n```\nclass Solution:\n    def minimumSeconds(self, nums: List[int]) -> int:\n        last_pos = {}\n        max_dist = defaultdict(int)\n        n = len(nums)\n        \n        for i in range(n * 2):\n            pos_i = i%n\n            if nums[pos_i] in last_pos:\n                max_dist[nums[pos_i]] = max(max_dist[nums[pos_i]], (pos_i - last_pos[nums[pos_i]] + n)%n)\n                if pos_i == last_pos[nums[pos_i]]:\n                    max_dist[nums[pos_i]] = n\n                last_pos[nums[pos_i]] = pos_i\n            else:\n                last_pos[nums[pos_i]] = pos_i\n        \n        min_dist_num = min(max_dist, key=max_dist.get)\n        return (max_dist[min_dist_num])//2\n```
['Python3']