1 Star 7 Fork 2

蔚蔚樱软件开发/AlgoHub

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
ShortPath.java 1.13 KB
一键复制 编辑 原始数据 按行查看 历史
ljfirst 提交于 2022-10-31 23:58 +08:00 . feat: update
package Algorithm.comprehensive.shortestDeliveryPath;
/**
* @author 蔚蔚樱
* @version 1.0
* @date 2020-02-11 14:36
* @author—Email micromicrohard@outlook.com
* @description 送货最短路径 接口 ShortestDeliveryPath
* 如图,某物流派送员p,需要给a、b、c、d4个快递点派送包裹, 请问派送员需要选择什么的路线,才能完成最短路程的派送。
* 假设如图派送员的起点坐标(0,0),派送路线只能沿着图中的方格边行驶,每个小格都是正方形,且边长为1,如p到d的距离就是4。
* 随机输入n个派送点坐标,求输出最短派送路线值(从起点开始完成n个点派送并回到起始点的距离)。
* @blogURL
*/
public interface ShortPath {
int shortPath(int[] position_row, int[] position_column);
default boolean check(int[] position_row, int[] position_column) {
if (position_row == null || position_column == null
|| position_row.length == 0 || position_column.length == 0
|| position_row.length != position_column.length) {
return false;
}
return true;
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/micromicrohard/algo-hub.git
git@gitee.com:micromicrohard/algo-hub.git
micromicrohard
algo-hub
AlgoHub
master

搜索帮助