We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Flatland Space Stations
Flatland Space Stations
Sort by
recency
|
905 Discussions
|
Please Login in order to post a comment
def flatlandSpaceStations(n, c): return max([min([abs(i-j) for j in c]) for i in range(n)])
Can anyone helps me? I only use one for loop but there 's still runtime error. Thank you:(( int flatlandSpaceStations(int n, int c_count, int* c) { /int res = 0; if (c_count == 1) return max(c_count-1, n-1-c_count); qsort(c, c_count, sizeof(int), cmp); int temp = 0; for (int i = 0; i < c_count-1; i++){ temp = (c[i+1] - c[i])/2; if (temp > res) res = temp; } res = max(max(c[0], n-1-c[c_count-1]), res); return res;/
}
Javascript