题目来源:leetcode62 不同路径 题目描述: 一个机器人位于一个 m x n 网格的左上角 (起始点在下图中标记为“Start” )。 机器人每次只能向下或者向右移动一步。机器人试图达到网格的右下角(在下图中标记为“Finish”)。 问总共有多少条不同的路径? 示例 1: 输入: m = ...
分类:
其他好文 时间:
2020-07-17 13:59:00
阅读次数:
52
./configure: line 16651: syntax error near unexpected token 0.20' ./configure: line 16651: PKG_PROG_PKG_CONFIG(0.20)' solution: pkg-config --version s ...
分类:
其他好文 时间:
2020-07-17 01:13:07
阅读次数:
88
利用二分图没有奇环的性质 DFS: class Solution { private: static constexpr int UNCOLORED = 0; static constexpr int RED = 1; static constexpr int GREEN = 2; vector<i ...
分类:
其他好文 时间:
2020-07-16 21:49:52
阅读次数:
71
LuoguP4279 [SHOI2008]小约翰的游戏 题目描述 链接 Solution Anti-SG的模板题 这里就直接放代码 #include<bits/stdc++.h> using namespace std; inline long long read() { long long f = ...
分类:
其他好文 时间:
2020-07-16 21:44:29
阅读次数:
72
思路染色问题,可以使用dfs,也可以使用bfs代码class Solution { boolean valid = true; int[][] graph; public boolean isBipartite(int[][] graph) { this.graph = graph; int n =... ...
分类:
其他好文 时间:
2020-07-16 21:42:04
阅读次数:
58
常考 大数乘法 题目链接:https://leetcode-cn.com/problems/multiply-strings/ class Solution { public: string multiply(string num1, string num2) { string res(num1.s ...
分类:
编程语言 时间:
2020-07-16 12:20:14
阅读次数:
64
链接:https://leetcode-cn.com/problems/subsets-ii/ 代码 class Solution { public: vector<vector<int>> ans; vector<int> path; vector<vector<int>> subsetsWith ...
分类:
其他好文 时间:
2020-07-16 00:27:10
阅读次数:
75
problem 1394. Find Lucky Integer in an Array solution #1: 使用哈希表; 使用哈希表记录数组元素和freq,然后判断是否相等,且取最大值; 注意 1. 最大值可以由下标一次递减隐性表示; 2. 数值的范围是1-500; 参考 1. leetco ...
分类:
其他好文 时间:
2020-07-16 00:22:19
阅读次数:
51
给定一个用字符数组表示的 CPU 需要执行的任务列表。其中包含使用大写的 A - Z 字母表示的26 种不同种类的任务。任务可以以任意顺序执行,并且每个任务都可以在 1 个单位时间内执行完。CPU 在任何一个单位时间内都可以执行一个任务,或者在待命状态。 然而,两个相同种类的任务之间必须有长度为 n ...
分类:
其他好文 时间:
2020-07-16 00:13:43
阅读次数:
73
# 二叉搜索树的特点是左子树小于根节点,右子树大于根节点。# 因此当根节点为i的时候,左子树的值为1:i-1,右子树为i+1:n# 当节点为n的时候所有的能够组成的树为左子树个数乘以右子树个数。class Solution: def numTrees(self, n: int) -> int: dp ...
分类:
其他好文 时间:
2020-07-15 23:51:44
阅读次数:
62