leetcode sliding maximum window

leetcode-2180-easy

Count Integers With Even Digit Sum Given a positive integer num, return the number of positive integers less than or equal to num whose digit sums are ......
leetcode 2180 easy

leetcode-1455-easy

Check If a Word Occurs As a Prefix of Any Word in a Sentence Given a sentence that consists of some words separated by a single space, and a searchWor ......
leetcode 1455 easy

leetcode-1464-easy

Maximum Product of Two Elements in an Array Given the array of integers nums, you will choose two different indices i and j of that array. Return the ......
leetcode 1464 easy

leetcode-1512-easy

Number of Good Pairs Given an array of integers nums, return the number of good pairs. A pair (i, j) is called good if nums[i] == nums[j] and i < j. E ......
leetcode 1512 easy

leetcode-1550-easy

Three Consecutive Odds Given an integer array arr, return true if there are three consecutive odd numbers in the array. Otherwise, return false. Examp ......
leetcode 1550 easy

leetcode-1572-easy

Matrix Diagonal Sum Given a square matrix mat, return the sum of the matrix diagonals. Only include the sum of all the elements on the primary diagona ......
leetcode 1572 easy

关于java:Windows:如何获取所有可见窗口的列表,并将指定窗口置顶

import com.sun.jna.Native; import com.sun.jna.Structure; import com.sun.jna.win32.StdCallLibrary; import org.apache.commons.lang3.StringUtils; import ......
Windows java

[LeetCode] 1688. Count of Matches in Tournament

You are given an integer n, the number of teams in a tournament that has strange rules: If the current number of teams is even, each team gets paired ......
Tournament LeetCode Matches Count 1688

Leetcode 80. 删除有序数组中的重复项 II

被前面类似的题禁锢了思路,自己写的双指针,感觉题解很巧妙,记录一下。这个解法不用记录cnt。 通用解法 为了让解法更具有一般性,我们将原问题的「保留 2 位」修改为「保留 k 位」。 对于此类问题,我们应该进行如下考虑: 由于是保留 k 个相同数字,对于前 k 个数字,我们可以直接保留 对于后面的任 ......
数组 Leetcode 80 II

Leetcode刷题day6-哈希表.双指针.三~四数求和.

454.四数相加Ⅱ 454. 四数相加 II - 力扣(LeetCode) 给你四个整数数组 nums1、nums2、nums3 和 nums4 ,数组长度都是 n ,请你计算有多少个元组 (i, j, k, l) 能满足: 0 <= i, j, k, l < n nums1[i] + nums2[ ......
指针 Leetcode day6 day

Golang(Go语言) 对windows进行注销、关机、重启、闪电关机、闪电重启的操作

有个小项目需要对windows系统进行远程电源操作,于是封装了以下代码方便使用。 目录结构如下: main.go package main import ( "fastshutdown/utils/power" "fmt" ) func main() { err := power.Shutdown( ......
windows 语言 Golang

windows批量修改文件名-ren命令(重命名)

windows批量修改文件名-ren命令(重命名) 重点:文件名一对一对应 1.进入要批量修改文件名的目录,在地址栏输入cmd,回车进入命令行模式 2.执行 dir /b>G:\Desktop\1.txt,将文件名拷贝到1.txt文件中。 3.新建一个excle表格,将文件名一对一对应,可借助分列排 ......
文件名 命令 windows 文件 ren

[LeetCode Hot 100] LeetCode19. 删除链表的倒数第N个结点

题目描述 思路一:采用两次遍历 第一遍遍历先获取链表的长度length 第二次从dummy节点开始走length - n步 然后将该节点指向下下个节点 思路二:采用一次遍历 设置虚拟节点dummyHead指向head 设定双指针p和q,初始都指向虚拟节点dummyHead 移动q,直到p与q之间相隔 ......
LeetCode 结点 Hot 100 19

[LeetCode Hot 100] LeetCode21. 合并两个有序链表

题目描述 思路:新建dummy去"穿针引线" 新建一个dummy节点去"穿针引线" 注意最后返回的是dummy.next 方法一: /** * Definition for singly-linked list. * public class ListNode { * int val; * List ......
LeetCode 两个 Hot 100 21

自定义Windows服务启动失败

一、报错内容 “无法从命令行或调试器启动服务,必须首先安装Windows服务(使用installutil.exe),然后用ServerExplorer、Windows服务器管理工具或NET START命令启动它” 二、解决方案 管理员身份运行cmd 进入到InstallUtil.exe的路径,使用c ......
Windows

关于在Windows环境下如何使用dtrace来获取程序运行的堆栈信息

如果启动的程序名为PerfTest.exe,对应的pid为30248,则打印堆栈调用信息的命令如下: dtrace -Fn "tick-5sec { exit(0);} pid30248:::entry/execname == \"PerfTest.exe\"/{ @num[ustack()] = ......
堆栈 Windows 环境 程序 dtrace

如何检测Windows服务停止后自动启动?自动运行.bat批处理文件?

想要确保你的Windows服务即使在崩溃后也能自动重启吗?这篇文章教你如何用一个小巧的批处理脚本来实现这一点。教你怎么设置定时检查,如果发现服务挂了,就立刻拉起来。跟着步骤做,让你的服务稳定运行不再是难题! ......
Windows 文件 bat

明年个人电脑将迎来大爆发!Windows 12、AI PC带来近年最强换机潮

经历多年萎靡之后,PC有望在明年迎来触底反弹,Windows更新周期加上AI PC的崛起,将带来近年最强换机潮。 全球知名科技市场独立分析机构Canalys发布的研报指出,全球个人电脑出货量在连续七个季度下跌后有望迎来复苏。 在节日旺季和宏观经济改善的推动下,预计2023年第四季度市场将增长5%。展 ......
个人电脑 Windows 电脑 个人

windows 文件夹共享 设置免密共享

https://jingyan.baidu.com/article/86f4a73ea60a6f37d6526985.html https://blog.csdn.net/lipengfei_1993/article/details/106297073 不要密码共享 有些上位机或者AOI相机的dat ......
文件夹 windows 文件

Windows Docker Desktop 设置镜像环境变量

Images->run->展开Optional settings container name :容器名称 Ports:根据你需要的端口进行输入,不输入则默认 Volumes:卷,也就是做持久化 需要docker 数据保存的地方 Environment variables:环境变量,也就是启动时需要 ......
变量 镜像 Windows Desktop 环境

[LeetCode Hot 100] LeetCode234. 回文链表

题目描述 思路1:将值复制到数组中然后使用双指针 计算链表的长度 创建等长的数组 将链表中的数依次放入数组中 使用左右指针判断链表是否是回文链表 时间复杂度:O(n) 空间复杂度:O(n) 思路2:快慢指针+反转链表 用快慢指针,快指针走两步,慢指针走一步,快指针遇到终止位置时,慢指针就在链表中间位 ......
LeetCode 回文 Hot 100 234

[LeetCode Hot 100] LeetCode206. 反转链表

题目描述 思路:双指针算法 方法一: /** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode() {} * ListNode(int val) ......
LeetCode Hot 100 206

[LeetCode Hot 100] LeetCode49. 字母异位词

题目描述 思路:哈希表 对字符串排序,如果是异位词,排序后就变成一样的了。 方法一: class Solution { public List<List<String>> groupAnagrams(String[] strs) { Map<String, List<String>> map = n ......
LeetCode 字母 Hot 100 49

[LeetCode Hot 100] LeetCode141. 环形链表

题目描述 思路:快慢指针 slow指针:每次移动一个节点 fast指针:每次移动两个节点 如果链表中存在环,fast指针最终会在某一时刻追上slow指针,这是由于移动速度快的fast指针会在某个时刻绕圈并追上速度慢的slow指针 条件 fast != null && fast.next != nul ......
LeetCode 环形 Hot 100 141

centos免密登录windows

一、linux操作: 二、windows操作: 1、Windows系统需安装OpenSSH服务; 2、配置OpenSSH服务端的配置文件: <1>管理员权限打开cmd终端,输入命令ssh-keygen -t rsa -f id_rsa执行后,将linux下生成的id_rsa.pub内容复制到C:\P ......
windows centos

5、半虚拟化驱动--virtio(linux和windows)和安装Windows server虚拟机

摘自:https://blog.51cto.com/mfc001/6410315 KVM的功能 主要体现在利用KVM的硬件辅助性虚拟化可以提高处理速度。 但在虚拟机中,有些硬件不是KVM来实现加速的,如磁盘、内存、网络的性能,如果更好的提升速度,需要安装半虚拟化驱动 1. 2. 3. 半虚拟化驱动 ......
Windows windows virtio server linux

Windows 项目的 CMakeLists 编写

前言: 项目一直是以 .sln 解决方案打开和处理的,上传到 github 也是需要将 sln 文件包括到项目里,不太优雅(虽然方便),毕竟现在开源项目基本都是使用 CMake 做跨平台编译 因为项目是以 Windows 编译为主,就只写了 CMakeLists 中的 Windows 的部分,后续如 ......
CMakeLists Windows 项目

[ARC141E] Sliding Edge on Torus 题解

题目链接 点击打开链接 题目解法 比较套路的题 首先画个图,然后把 \(y-x\) 相同的变成一个点(使 \(y>x\)) 然后再两个点之间连有权边 那么问题就变成求新图的每个连通块中形成的原图的连通块数量 手玩几个数据发现,原图的连通块数量即为新图的所有环长的 \(\gcd\),再和 \(n\) ......
题解 Sliding Torus 141E Edge

[LeetCode] 2264. Largest 3-Same-Digit Number in String

You are given a string num representing a large integer. An integer is good if it meets the following conditions: It is a substring of num with length ......
Same-Digit LeetCode Largest Number String

LeetCode-Java:55.跳跃游戏

题目 给你一个非负整数数组 nums ,你最初位于数组的 第一个下标 。数组中的每个元素代表你在该位置可以跳跃的最大长度。 判断你是否能够到达最后一个下标,如果可以,返回 true ;否则,返回 false 。 示例 1: 输入:nums = [2,3,1,1,4] 输出:true 解释:可以先跳 ......
LeetCode-Java LeetCode Java 55