leetcode 454 ii
LeetCode 301. 删除无效的括号
``` class Solution { public: vector ans; vector removeInvalidParentheses(string s) { //lr分别记录要删除的左右括号数量 int l=0,r=0; for(auto c:s) if(c=='(') l++; els ......
[LeetCode] 1851. Minimum Interval to Include Each Query
You are given a 2D integer array intervals, where intervals[i] = [lefti, righti] describes the ith interval starting at lefti and ending at righti (in ......
685. 冗余连接 II
在本问题中,有根树指满足以下条件的 有向 图。该树只有一个根节点,所有其他节点都是该根节点的后继。该树除了根节点之外的每一个节点都有且只有一个父节点,而根节点没有父节点。 输入一个有向图,该图由一个有着 n 个节点(节点值不重复,从 1 到 n)的树及一条附加的有向边构成。附加的边包含在 1 到 n ......
leetcode2130反转链表
1尾插法:记录前面的节点,使后面的节点指向前面的节点;记后面的节点为now。因为要不停移动now,使其移动所以要临时记录原来之后的节点。 ListNode* now=slow->next; ListNode* pre=nullptr; while(now){ ListNode* node=now-> ......
iis7中session丢失的解决方法小结
Windows Server 2008 +IIS +ASP.net +SQLServer2008搭建的内部WEB系统。 用户Session总是丢失,可能是IIS的不稳定性将导致Session频繁丢失。 用的是Session=SQLSEVER,即把Session保存到数据库。 解决方法: 1,在命令行 ......
8-102-(LeetCode- 207&210) 课程表II
1. 题目 读题 210. 课程表 II 考查点 2. 解法 思路 这道题的解答思路是使用拓扑排序来判断有向图是否有环,如果有环,说明无法完成所有课程,如果没有环,输出拓扑排序的结果。拓扑排序的基本思想是从有向图中选择一个没有前驱(即入度为0)的顶点并输出,然后从图中删除该顶点和所有以它为起点的有向 ......
LeetCode 287. 寻找重复数
``` class Solution { public: int findDuplicate(vector& nums) { if(nums.size()<2) return nums[0]; int n=nums.size(); int fast=0,slow=0; do { slow=nums[ ......
LeetCode 热题 100 之 160. 相交链表
# 题目描述 给你两个单链表的头节点 headA 和 headB ,请你找出并返回两个单链表相交的起始节点。如果两个链表不存在相交节点,返回 null 。 图示两个链表在节点 c1 开始相交:  和 (i, height[i]) 。 找出其中的两条线,使得它们与 x 轴共同构成的容器可以容纳最多的水。 返回容器可以储存的最大水量。 说明:你不能倾斜容器。 示例 1: ,技术和职场问题,请关注公众号 [彭旭锐] 和 [BaguTree Pro] 知识星球提问。** > > 学习数据结构与算法的关键在于掌握问题背后的算法思 ......
IIS打开设置
IIS在win10默认是不打开的。 1、打开控制面板(win10) win+r 输入control 选择 程序 程序和功能_启用或关闭windows功能 选择 IIS,确定后等待即可打开 2、查看管理 选择一下路径,双击打开 查看详细设置。 左侧点击 网站 默认网站web site 右侧点击 基本设 ......
leetcode day4 24 19 面试题02.07 142
[toc] #24. 两两交换链表中的节点   有$f[i]=max(f[i-1],a[i]-a[j]+f[j-1])$,第一个决策表示未在当天购入股票 稍微优化即可,复杂度为$O(n)$ ``` #include using namespace std; ......
LeetCode -- 870. 优势洗牌
贪心:这种最大化类似于田忌赛马。 每次取出nums1中最小的,和nums2进行比较,如果打得过,就打;打不过就用当前最小的和nums2中最大的换掉 c ++ class Solution { public: vector<int> advantageCount(vector<int>& nums1, ......
代码随想录算法训练营第三十一天| 62.不同路径 63. 不同路径 II
62.不同路径 思路: 因为只能向左,和向下,因此只能是前面的加上左边的,递推公式较为简单 代码: 1 int uniquePaths(int m, int n) { 2 if (m == 1 || n == 1) return 1; 3 4 vector<vector<int>> nums(m, ......
leetcode刷题记录Java
``` 难度等级:简单 给你两个字符串 word1 和 word2 。请你从 word1 开始,通过交替添加字母来合并字符串。 如果一个字符串比另一个字符串长,就将多出来的字母追加到合并后字符串的末尾。 返回 合并后的字符串 。 class Solution { public String merg ......
leetcode刷题记录(C语言)
``` 给你两个字符串 word1 和 word2 。请你从 word1 开始,通过交替添加字母来合并字符串。 如果一个字符串比另一个字符串长,就将多出来的字母追加到合并后字符串的末尾。 返回 合并后的字符串 。 输入:word1 = "abc", word2 = "pqr" 输出:"apbqcr" ......
Leetcode283. 移动零
``` class Solution { public: void moveZeroes(vector& nums) { if(nums.empty()) return; int n=nums.size(); int idx=n-1; while(idx>=0&&nums[idx]==0) idx- ......
Leetcode240.搜索二维矩阵II
``` class Solution { public: bool searchMatrix(vector>& matrix, int target) { if(matrix.empty()||matrix[0].empty()) return false; int n=matrix.size(), ......
[LeetCode] 1218. Longest Arithmetic Subsequence of Given Difference
Given an integer array arr and an integer difference, return the length of the longest subsequence in arr which is an arithmetic sequence such that th ......
LeetCode 354. Russian Doll Envelopes 排序+LIS
You are given a 2D array of integers `envelopes` where `envelopes[i] = [wi, hi]` represents the width and the height of an envelope. One envelope can ......
LeetCode 519. Random Flip Matrix 哈希Map
There is an `m x n` binary grid matrix with all the values set 0 initially. Design an algorithm to randomly pick an index `(i, j)` where `matrix[i][j] ......
windows Server 2008 R2服务器IIS环境启用TLS 1.2
windows Server 2008 R2服务器IIS环境启用TLS 1.2,配置TLS1.2 分为2步, 添加TLS配置和禁用老的SSL版本,提供两种方法, 选择其中一种就行了,手动设置 打开注册表,运行regedit,找到 HKEY_LOCAL_MACHINE\SYSTEM\CurrentCo ......
LeetCode 239. 滑动窗口最大值
``` class Solution { public: vector maxSlidingWindow(vector& nums, int k) { deque q; vector res; for(int i=0;i=k) q.pop_front(); //插入新元素 while(q.size( ......
.NET 7发布到IIS HTTP 错误 500.19 - Internal Server Error
之前一直都是用的独立发布,就没有配置过服务器环境,今天发布了一个依赖版,果不其然报错了 一番查找之后原因也是很简单,服务器需要安装一个.NET运行时的环境 https://dotnet.microsoft.com/zh-cn/download/dotnet/7.0 打开之后下载这一个,你也可以选择下 ......
使用iis部署个人网站后同一个局域网中无法访问解决办法
在我部署号网站以后,设置了特定端口,自己电脑可以访问,但是同事电脑无法访问我的网站。这个问题是没有开启入站端口 下面是开启入站端口的方法 方法/步骤 1 回到桌面,右键单击计算机选择属性,如下图所示 2 属性面板点击控制面板主页,如下图所示 3 控制面板点击系统与安全进入, 如下图所示 4 系统安全 ......