1. 首页
  2. 数据库
  3. 其它
  4. Cheapest Flights Within K Stops

Cheapest Flights Within K Stops

上传者: 2021-02-01 11:22:20上传 PDF文件 24KB 热度 7次
Example 1: Input: n = 3, edges = [[0,1,100],[1,2,100],[0,2,500]] src = 0, dst = 2, k = 1 Output: 200 Explanation: The graph looks like this: 思路:就是要弄明白graph怎么建立,pq里面存什么,怎么进行搜索; graph: HashMap 存 from , pq: 存Node Node sort by cost; 搜索:if( step > 0) 继续,if city = dst 表示找到,直接返回当前cost
下载地址
用户评论