NEU1685 All Pair Shortest Path(bfs+set优化) February 16, 2016 题目链接 题意:输入一个 01 矩阵表示的有向图,D(i,j)表示 i 到 j 的最短路中的长度,求所有 D(i,j)*D(i,j)的和。 思路:枚举每个点作为源点,从源点出发 bfs,记录到源点的距离。如果用 vis[]来记录点是否到达的话,那么将是一个...
2642.Design-Graph-With-Shortest-Path-Calculator (M+) 2959.Number-of-Possible-Sets-of-Closing-Branches (M+) 2976.Minimum-Cost-to-Convert-String-I (M+) 3387.Maximize-Amount-After-Two-Days-of-Conversions (H-) Hungarian Algorithm 1820.Maximum-Number-of-Accepted-Invitations (H) 2123.Minimum-Ope...
Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that repeatedly steps through the list to be sorted, compares each pair of adjacent items and swaps them if they are in the wrong order. The pass through the list is repeated until no swaps are needed, which...
DP on Trees Tutorial [Tutorial] Li Chao Tree Extended [Tutorial] Convex Hull Trick — Geometry being useful Lecture #3 — Exchange arguments (sorting with dp) Matrix Exponentiation tutorial + training contest Linear Recurrence and Berlekamp-Massey Algorithm Dynamic Programming Optimizations [Tutorial] ...
Array Kadane's Algorithm https://leetcode.com/problems/maximum-subarray/ Array Merge Intervals https://leetcode.com/problems/merge-intervals/ Array Next Permutation https://leetcode.com/problems/next-permutation/ Array Count Inversions <->
《看得见的算法》课程, 代码仓: Play-with-Algorithm-Visualization 《玩转数据结构》课程, 代码仓: Play-with-Data-Structures LeetCode Explore题解代码仓:Play Leetcode Explore (注:以C++实现为主) Leetcode Explore 是Leetcode 在2017年底上线的新模块,分门别类地整理了Leetcode上的问题。如果刷Leetcode一...
1014-Best-Sightseeing-Pair/cpp-1014 1014-Best-Sightseeing-Pair/cpp-1014 1015-Smallest-Integer-Divisible-by-K/cpp-1015 1015-Smallest-Integer-Divisible-by-K/cpp-1015 1016-Binary-String-With-Substrings-Representing-1-To-N/cpp-1016 1016-Binary-String-With-Substrings-Representing-1-To-N/cpp-1016 ...
2851 String Transformation C++ Python O(n + logk) O(n) Hard DP, Matrix Exponentiation, Math, Z-Function, KMP Algorithm 2937 Make Three Strings Equal C++ Python O(n) O(1) Easy String 2942 Find Words Containing Character C++ Python O(n * l) O(1) Easy String 2967 Minimum Cost to Mak...
状态压缩DP 465.Optimal-Account-Balancing (H) 691.Stickers-to-Spell-Word (H) 943.Find-the-Shortest-Superstring (H+) 1125.Smallest-Sufficient-Team (H) 1349.Maximum-Students-Taking-Exam (H) 1411.Number-of-Ways-to-Paint-N×3-Grid (M) 1434.Number-of-Ways-to-Wear-Different-Hats-to-Each...
0719-Find-K-th-Smallest-Pair-Distance/cpp-0719 contest 56 problems added. Oct 30, 2017 0720-Longest-Word-in-Dictionary/cpp-0720 0720-Longest-Word-in-Dictionary/cpp-0720 720 trie algo added. Nov 5, 2017 0721-Accounts-Merge/cpp-0721 0721-Accounts-Merge/cpp-0721 721 solved. Nov 26, 2017 ...