• 2024-09-16求序列中最长不升子序列的长度和不升子序列的个数
    狄尔沃斯定理(Dilworth'stheorem)该定理表述为:在一个有限的偏序集 P 中,最大抗链的大小等于最小覆盖的大小。换句话说,若 P 是一个有限的偏序集,且 α 是 P 中的一个最大抗链(即其中任意两个元素不可比较),而 β是 P 的一个最小覆盖(即覆盖所有元素的最小链),则有:∣α∣=∣β
  • 2024-08-202024 Summer_Camp 做题总结 下
    CloseVertices思路很明显,这是一道点分治题目,但有两个限制条件,考虑将两个条件排序起来,双指针找第一个条件,树状数组维护第二个条件,但是同一个子树内不能重复统计,所以将答案减去每个子树内的答案。代码#include<iostream>#include<algorithm>#defineintlonglongusingnam
  • 2024-06-01LeetCode 1305. All Elements in Two Binary Search Trees
    原题链接在这里:https://leetcode.com/problems/all-elements-in-two-binary-search-trees/description/题目:Giventwobinarysearchtrees root1 and root2,return alistcontainingalltheintegersfrombothtreessortedin ascending order.Example1:Input:
  • 2024-05-20844 比较含退格的字符串
    classSolution{publicbooleanbackspaceCompare(Strings,Stringt){Stack<Integer>stk1=newStack<Integer>();Stack<Integer>stk2=newStack<Integer>();comP(stk1,s);comP(stk2,t);