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
|
951 Discussions
|
Please Login in order to post a comment
Java 8 solution:
I tried the below solution which seemed to pass all the test cases. This solution sorts the input array and has a time complexity of O(nlog(n)). The algorithm used is somewhat related to the two-pointer algorithm.
static int flatlandSpaceStations(int n, int[] c) {
Is the custom comparator too much? Maybe. But it's funnier that way.
JAVA
static int flatlandSpaceStations(int n, int[] c) {