You are viewing a single comment's thread. Return to all comments →
C#
var distancesBetweenStations = new List<int>(); Array.Sort(c); distancesBetweenStations.Add(c[0]); distancesBetweenStations.Add(n - c[c.Length - 1] - 1); for (int i = 1; i < c.Length; i++) { distancesBetweenStations.Add((c[i] - c[i-1])/2); } return (distancesBetweenStations.Max(j => j));
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
Flatland Space Stations
You are viewing a single comment's thread. Return to all comments →
C#