地址 https://www.acwing.com/problem/content/description/852/ 这里相比上一篇 Dijkstra模板 使用了堆记录点距离 从而节省了查找最短距离的开销 给定一个n个点m条边的有向图,图中可能存在重边和自环,所有边权均为非负值。 请你求出1号点到n ...
操作 数据库 Go 语言中的 database/sql 包定义了对数据库的一系列操作。database/sql/driver 包定义了应被数据库驱动实现的接口,这些接口会被 sql 包使用。但是 Go 语言没有提 供任何官方的数据库驱动,所以我们需要导入第三方的数据库驱动。不过我们连接数据 库之后对 ...
分类:
数据库 时间:
2019-12-16 13:34:43
阅读次数:
96
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any p ...
分类:
其他好文 时间:
2019-12-16 09:18:17
阅读次数:
102
原题链接在这里:https://leetcode.com/problems/unique-paths-iii/ 题目: On a 2-dimensional grid, there are 4 types of squares: 1 represents the starting square. T ...
分类:
其他好文 时间:
2019-12-16 09:15:54
阅读次数:
94
C++11 std::unique_lock与std::lock_guard区别及多线程应用实例 C++11 std::unique_lock与std::lock_guard区别及多线程应用实例 C++11 std::unique_lock与std::lock_guard区别及多线程应用实例 C++ ...
分类:
编程语言 时间:
2019-12-15 21:59:10
阅读次数:
105
与上一题差不多。但结果不能重复,我们可以做一个去重处理 javascript var combinationSum2 = function (nums, target) { if (!Object(nums).length) { return []; } nums.sort() var uniq = ...
分类:
其他好文 时间:
2019-12-15 18:14:11
阅读次数:
92
题目来源: "领扣 | LintCode" 有 i 个物品和一个总容量为 j 的背包. 给定数组 weight 表示每个物品的重量和数组 value 表示每个物品的价值,求最大价值。(物品不能分割) 背包问题II 这道题是一道动态规划(dp)算法的基础题,有两种实现方式,分别是递归和递推(迭代),前 ...
分类:
其他好文 时间:
2019-12-15 12:28:45
阅读次数:
83
题目如下: Given a square grid of integers arr, a falling path with non-zero shifts is a choice of exactly one element from each row of arr, such that no t ...
分类:
其他好文 时间:
2019-12-15 10:26:34
阅读次数:
108
地址 https://leetcode-cn.com/contest/biweekly-contest-15/problems/minimum-falling-path-sum-ii/ 题目描述给你一个整数方阵 arr ,定义「非零偏移下降路径」为:从 arr 数组中的每一行选择一个数字,且按顺序选 ...
分类:
其他好文 时间:
2019-12-15 01:00:24
阅读次数:
74
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array whic ...
分类:
其他好文 时间:
2019-12-15 00:47:24
阅读次数:
67