我正在尝试从一个图中获取两个节点,这两个节点等于该图中连接最多的边,并以字符串的形式返回值。怎么做!?
启动器代码:
编写一个解决方法,返回由线(边)和k个电力杆(节点)表示的给定电力线基础设施的最大覆盖率。
public class Solution1 {
public static void main(String[] args) {
Solution sol = new Solution();
// Your solution may be tested with random input like this.
// The actual test cases will vary.
int[][] lines = new int[][] {
{1,2},{1,3},{0,1},{0,3}
};
System.out.println(sol.getMaxCoverage(lines, 4)); // 4
}
}
class Solution {
public String getMaxCoverage(int[][] lines, int k) {
}
}发布于 2021-05-26 21:44:16
https://stackoverflow.com/questions/67705093
复制相似问题