735行星碰撞 Posted on 2020-05-12 Words count in article: 543 | Reading time ≈ 2 下面我自己调了一万年的狗屎算法我的思路是这样的 如果数组非空 判断新来的和老的是否同号 同号push 异号->判断是相近还是相离 相离,push 相近->判断尾部函数是不是大于新来的元素的绝对值 大于->撞死,下一轮循环 等于->pop+continue 小于->p ... Read more »
离散概率 Posted on 2020-05-12 Words count in article: 1.3k | Reading time ≈ 6 离散概率 概念运算加 if $A\cap B = \emptyset$ $P(A\cup B) = P(A)+P(B)$ TheoremLet E1 and E2 be events in the sample space $\Omega$.Then $P(E_1\cup E_2)= P(E_1 ... Read more »
880索引处地解码字符串 Posted on 2020-05-11 Words count in article: 488 | Reading time ≈ 2 我按照字符串解码的思路,超时了123456789101112131415161718192021222324252627282930313233class Solution {public: string decodeAtIndex(string S, int K) { ... Read more »
456find132pattern Posted on 2020-05-11 Words count in article: 536 | Reading time ≈ 2 555,BF失败!12345678910111213141516171819class Solution {public: bool find132pattern(vector<int>& nums) { if(nums.size()& ... Read more »
1381设计一个支持增量操作的栈 Posted on 2020-05-11 Words count in article: 128 | Reading time ≈ 1 1381设计一个支持增量操作的栈 下面是解法123456789101112131415161718192021222324252627282930313233class CustomStack {private: vector<int>v; int top;publ ... Read more »
1003检查替换后的词 Posted on 2020-05-11 Words count in article: 326 | Reading time ≈ 1 1003 检查替换后的词下面是题目 方法和1209删除字符串中所有重复项II中的方法一样,我愿意称之为龙珠算法QQ 碰到 abc,删除或递归 代码实现用了删除和递归两种方法,但是时间都好慢啊。。。 123456789101112131415class Solution {public:bo ... Read more »
格林公式 Posted on 2020-05-11 Words count in article: 1.4k | Reading time ≈ 5 格林公式 区域D的分类 单连通区域(无洞区域) 多连通区域(有洞区域) 域D边界L的正向:域的内部靠左,这两个方向都是正向 定理设区域D是由分段光滑正向曲线L围成,函数P(x,y),Q(x,y)在D上具有连续的一阶偏导数。则有 推论根据格林公式:正向闭曲线L所围成的区域D的面积 $ ... Read more »
GeneratingPermutations Posted on 2020-05-10 Words count in article: 789 | Reading time ≈ 4 离散数学的一个求下一个较大排列的算法问题引入 Example: Permutation 23415 of set {1, 2, 3, 4, 5} precedes the per-mutation 23514. Similarly, permutation 41532 precedes 52143. ... Read more »
计数原理 Posted on 2020-05-10 Words count in article: 1.7k | Reading time ≈ 7 计数原理 Counting principles + Product rule + Sum rule + Subtraction rule + Division rule Permutations Combinations 定义如下 我们拿到题目要看看到底是要求我们用排列做还是组合做,可否重 ... Read more »
高级计数工具 Posted on 2020-05-10 Words count in article: 212 | Reading time ≈ 1 高级计数工具—4.1,4.2归纳递推关系的应用 斐波那契 汉诺塔 递推关系的相关算法贪心算法一维的动态规划 应用 方法:记笔记的方法 二维的动态规划: 应用 解答和代码在博文编辑距离问题 解答和代码在博文背包问题 解决线性递推关系详见博客齐次线性和非齐次线性 齐次线性递推关系LHRR非齐次线性 ... Read more »