Ruby: Simple and intuitive solution
\n##calculates the number of times each nodes are visited and saves it in hash.\ndef calculate(result,n,start,last)\n    if start<=last\n        (start..last).e
```\n##calculates the number of times each nodes are visited and saves it in hash.\ndef calculate(result,n,start,last)\n    if start<=last\n        (start..last).each do |key|\n            result[key]+=1\n        end\n    else\n        (start..n).each do |key|\n            result[key]+=1\n        end\n        (1..last).each do |key|\n            result[key]+=1\n        end\n    end\nend\n\ndef most_visited(n, rounds)\n    output=[]\n    prev = rounds[0]\n    result = Hash.new(0)\n    (1...rounds.size).each do |i|\n        start = prev\n        last=rounds[i]\n        calculate(result,n,start,last)\n        prev=last+1   \n    end\n    \n    ##find the most visited value\n    max_val = result.values.max\n    \n    ##select the nodes with most visited value\n    result.select{|key,val| val==max_val}.keys.sort!\nend\n```
[]