leetcode 45 ii

[LeetCode] 874. Walking Robot Simulation

A robot on an infinite XY-plane starts at point (0, 0) facing north. The robot can receive a sequence of these three possible types of commands: -2: T ......
Simulation LeetCode Walking Robot 874

[LeetCode] 2597. The Number of Beautiful Subsets

You are given an array nums of positive integers and a positive integer k. A subset of nums is beautiful if it does not contain two integers with an a ......
Beautiful LeetCode Subsets Number 2597

代码随想录算法训练营第59天 | ● 503.下一个更大元素II ● 42. 接雨水 - 第10章 动态规划part02

第十章 单调栈part02 ● 503.下一个更大元素II ● 42. 接雨水 详细布置 503.下一个更大元素II 这道题和 739. 每日温度 几乎如出一辙,可以自己尝试做一做 https://programmercarl.com/0503.%E4%B8%8B%E4%B8%80%E4%B8%AA ......
随想录 训练营 随想 算法 雨水

LeetCode 852. Peak Index in a Mountain Array 二分

An array arr a mountain if the following properties hold: * `arr.length` >= 3 * There exists some i with `0 arr[i + 1] > ... > arr[arr.length - 1] ``` ......
LeetCode Mountain Index Array Peak

剑指 Offer 58 - II. 左旋转字符串

``` class Solution { public: string reverseLeftWords(string s, int n) { reverse(s.begin(),s.begin()+n); #反转用reverse而不是s.reverse reverse(s.begin()+n,s. ......
左旋 字符串 字符 Offer 58

CF1769C2 Подкрутка II 题解

看到同机房的好哥们发了贪心做法的题解,心血来潮就A了这道题写了真·dp的题解。 虽然方法比老师上课讲的麻烦的多,并不是最优解,但至少是我自己思考得出的结果。 ## 题目要求 输入一个原序列 $a_i$,从 $a_i$ 中求得某个区间 $[l,r]$。 此区间经过题面中所描述的修改操作(任何元素 $+ ......
题解 1769C 1769 CF C2

leetcode104二叉树搜索

深度优先搜索,递归 maxDepth(TreeNode* root){ if(!root)return 0; return max(maxDepth(root->left),maxDepth(root->right))+1; } 广度优先搜索,队列 queue<TreeNode*>q; q.push ......
leetcode 104

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 301

[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 ......
LeetCode Interval Include Minimum Query

685. 冗余连接 II

在本问题中,有根树指满足以下条件的 有向 图。该树只有一个根节点,所有其他节点都是该根节点的后继。该树除了根节点之外的每一个节点都有且只有一个父节点,而根节点没有父节点。 输入一个有向图,该图由一个有着 n 个节点(节点值不重复,从 1 到 n)的树及一条附加的有向边构成。附加的边包含在 1 到 n ......
冗余 685 II

leetcode2130反转链表

1尾插法:记录前面的节点,使后面的节点指向前面的节点;记后面的节点为now。因为要不停移动now,使其移动所以要临时记录原来之后的节点。 ListNode* now=slow->next; ListNode* pre=nullptr; while(now){ ListNode* node=now-> ......
leetcode 2130

iis7中session丢失的解决方法小结

Windows Server 2008 +IIS +ASP.net +SQLServer2008搭建的内部WEB系统。 用户Session总是丢失,可能是IIS的不稳定性将导致Session频繁丢失。 用的是Session=SQLSEVER,即把Session保存到数据库。 解决方法: 1,在命令行 ......
小结 session 方法 iis7 iis

8-102-(LeetCode- 207&210) 课程表II

1. 题目 读题 210. 课程表 II 考查点 2. 解法 思路 这道题的解答思路是使用拓扑排序来判断有向图是否有环,如果有环,说明无法完成所有课程,如果没有环,输出拓扑排序的结果。拓扑排序的基本思想是从有向图中选择一个没有前驱(即入度为0)的顶点并输出,然后从图中删除该顶点和所有以它为起点的有向 ......
课程表 LeetCode 课程 102 207

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 287

LeetCode 热题 100 之 160. 相交链表

# 题目描述 给你两个单链表的头节点 headA 和 headB ,请你找出并返回两个单链表相交的起始节点。如果两个链表不存在相交节点,返回 null 。 图示两个链表在节点 c1 开始相交: ![image](https://img2023.cnblogs.com/blog/2204134/202 ......
LeetCode 100 160

LeetCode 热题 100 之 15. 三数之和

# 题目描述 给你一个整数数组 nums ,判断是否存在三元组 [nums[i], nums[j], nums[k]] 满足 i != j、i != k 且 j != k ,同时还满足 nums[i] + nums[j] + nums[k] == 0 。请 你返回所有和为 0 且不重复的三元组。 注 ......
之和 LeetCode 100 15

LeetCode 热题 100 之 11. 盛最多水的容器

# 题目描述 给定一个长度为 n 的整数数组 height 。有 n 条垂线,第 i 条线的两个端点是 (i, 0) 和 (i, height[i]) 。 找出其中的两条线,使得它们与 x 轴共同构成的容器可以容纳最多的水。 返回容器可以储存的最大水量。 说明:你不能倾斜容器。 示例 1: ![im ......
容器 LeetCode 100 11

LeetCode 793. Preimage Size of Factorial Zeroes Function 二分

Let `f(x)` be the number of zeroes at the end of x!. Recall that $x! = 1 * 2 * 3 * ... * x$ and by convention, 0! = 1. For example,` f(3) = 0` because ......
Factorial LeetCode Function Preimage Zeroes

LeetCode 周赛上分之旅 #33 摩尔投票派上用场

> ⭐️ **本文已收录到 [AndroidFamily](https://github.com/pengxurui/AndroidFamily),技术和职场问题,请关注公众号 [彭旭锐] 和 [BaguTree Pro] 知识星球提问。** > > 学习数据结构与算法的关键在于掌握问题背后的算法思 ......
用场 LeetCode 之旅 33

IIS打开设置

IIS在win10默认是不打开的。 1、打开控制面板(win10) win+r 输入control 选择 程序 程序和功能_启用或关闭windows功能 选择 IIS,确定后等待即可打开 2、查看管理 选择一下路径,双击打开 查看详细设置。 左侧点击 网站 默认网站web site 右侧点击 基本设 ......
IIS

leetcode day4 24 19 面试题02.07 142

[toc] #24. 两两交换链表中的节点 ![](https://img2023.cnblogs.com/blog/3239608/202307/3239608-20230715224335895-687431293.png) ![](https://img2023.cnblogs.com/blo ......
leetcode 02.07 day4 day 142

LeetCode 658. Find K Closest Elements 二分+双指针

Given a sorted integer array `arr`, two integers `k` and `x`, return the `k` closest integers to `x` in the array. The result should also be sorted in ......
指针 LeetCode Elements Closest Find

acwing1055股票买卖 II

其实做这题我一眼DP... 设$f[i]$表示前$i$天能够获得的最大利润(肯定未持股) 有$f[i]=max(f[i-1],a[i]-a[j]+f[j-1])$,第一个决策表示未在当天购入股票 稍微优化即可,复杂度为$O(n)$ ``` #include using namespace std; ......
股票 acwing 1055 II

LeetCode -- 870. 优势洗牌

贪心:这种最大化类似于田忌赛马。 每次取出nums1中最小的,和nums2进行比较,如果打得过,就打;打不过就用当前最小的和nums2中最大的换掉 c ++ class Solution { public: vector<int> advantageCount(vector<int>& nums1, ......
LeetCode 优势 870

华普物联RS485/RS232双串口服务器 转以太网串口 RJ45 河南华普 HPIOT

一款工业级串口服务器,实现了RJ45网口与RS485或RS232之间的数据透明传输;支持Modbus网关功能;支持多种保活机制;支持注册包+双向心跳包、虚拟串口、自动重连等功能。 公司介绍 华普物联科技产品包括物联网网关、工业无线路由器、LoRa基站、DTU、RTU、远程IO等产品,以及支持边缘计算 ......
串口 以太网 服务器 HPIOT RS

代码随想录算法训练营第三十一天| 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 Java

leetcode刷题记录(C语言)

``` 给你两个字符串 word1 和 word2 。请你从 word1 开始,通过交替添加字母来合并字符串。 如果一个字符串比另一个字符串长,就将多出来的字母追加到合并后字符串的末尾。 返回 合并后的字符串 。 输入:word1 = "abc", word2 = "pqr" 输出:"apbqcr" ......
leetcode 语言

华普物联RS485/RS232双串口服务器 转以太网串口 RJ45 河南华普 HPIOT

一款工业级串口服务器,实现了RJ45网口与RS485或RS232之间的数据透明传输;支持Modbus网关功能;支持多种保活机制;支持注册包+双向心跳包、虚拟串口、自动重连等功能。 公司介绍 华普物联科技产品包括物联网网关、工业无线路由器、LoRa基站、DTU、RTU、远程IO等产品,以及支持边缘计算 ......
串口 以太网 服务器 HPIOT RS

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- ......
Leetcode 283