题库 总和leetcode 39
LeetCode -- 918. 环形子数组的最大和
遇到环形问题一般有两种考虑方法: 1.破环成链 2.分为数组中间部分和数组两边部分分别考虑 本题采用第二种考虑方法,将原数组分为中间部分和两边部分分别考虑。中间部分即为子数组最大和,两边部分计总和减去中间部分最小和。 class Solution { public: int maxSubarrayS ......
LeetCode 热题 100 之 128. 最长连续序列
#题目描述 给定一个未排序的整数数组 nums ,找出数字连续的最长序列(不要求序列元素在原数组中连续)的长度。 请你设计并实现时间复杂度为 **O(n)**的算法解决此问题。 示例 1: 输入:nums = [100,4,200,1,3,2] 输出:4 解释:最长数字连续序列是 [1, 2, 3, ......
LeetCode -- 826. 安排工作以达到最大收益
方法一:二分加枚举 通过二分快速查找小于某个难度值的最大价值。 class Solution { public: int maxProfitAssignment(vector<int>& difficulty, vector<int>& profit, vector<int>& worker) { ......
mybatis-plus Error attempting to get column 'xxx' from result set.
报错信息: mybatis-plus Error attempting to get column 'xxx' from result set. 解决: 1、获取数据的实体类中新建了一个有参的构造方法,却没有无参构造方法,使用MyBatis-Plus内置方法进行查询时会报错。 解决办法: 新建一个无 ......
CodeForces 1364D Ehab's Last Corollary
[洛谷传送门](https://www.luogu.com.cn/problem/CF1364D "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/1364/D "CF 传送门") 简单题。 特判掉 $m = n - 1$ 的情况 ......
fatal: 无法访问 'https://github.com/nmww/lingyun.git/':Failed to connect to github.com port 443 after 13 ms: Connection refused
fatal: 无法访问 'https://github.com/nmww/lingyun.git/':Failed to connect to github.com port 443 after 13 ms: Connection refused git config --global https. ......
7-11 leetcode 2612
请你编写一个异步函数,它接收一个正整数参数 millis ,并休眠这么多毫秒。要求此函数可以解析任何值。 ps: promise 期约函数 (异步函数)的使用 ,promise 是一个对象 new promise /** * @param {number} millis */ async funct ......
7-11 leetcode 2619
请你编写一段代码实现一个数组方法,使任何数组都可以调用 array.last() 方法,这个方法将返回数组最后一个元素。如果数组中没有元素,则返回 -1 。 ps:this 环境变量的使用 ,this.length 的返回值是数字类型 代码实现: <script> //在数组的原型写扩展方法可以给所 ......
django python manage.py migrate 后报错字段长度超了 django.db.utils.OperationalError: (1118 'Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535.
现象: 在models.py 将CharField字段的maxlength=修改后,执行ython manage.py migrate 报错django.db.utils.OperationalError: (1118 'Row size too large. The maximum row siz ......
LeetCode 剑指 Offer 08. 二叉树的下一个节点
## 题目:二叉树的下一个节点 **给定一棵二叉树的其中一个节点,请找出中序遍历序列的下一个节点。(树的后继)** **注意:** - **如果给定的节点是中序遍历序列的最后一个,则返回空节点;** - **二叉树一定不为空,且给定的节点一定不是空节点;** ## 解题思路  ##题意: **在一个 n * m 的二维数组中,每一行都按照从左到右 非递减 的顺序 ......
【线段树】【leetcode 729. 我的日程安排表 I】
class MyCalendar { class Seg { int l; int r; boolean val; Seg left; Seg right; public Seg(int x, int y) { this.l = x; this.r = y; this.val = false; th ......
pom.xml增加Mybatisplus的依赖后报错:Factory method 'sqlSessionFactory' threw exception; nested exception is java.lang.NoClassDefFoundError: org/mybatis/logging/LoggerFactory
出现上面的问题,是版本不匹配导致。 <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>2.2.0</version ......
LeetCode 146. LRU 缓存()
[原题解](https://leetcode.cn/problems/lru-cache/solutions/259678/lruhuan-cun-ji-zhi-by-leetcode-solution/) ###题目 看似没考 LIS 最长递增子序列,好像又考了
> **本文已收录到 [AndroidFamily](https://github.com/pengxurui/AndroidFamily),技术和职场问题,请关注公众号 [彭旭锐] 和 [BaguTree Pro] 知识星球提问。** - 往期回顾:[LeetCode 单周赛第 352 场 · 一 ......
LeetCode 周赛(2023/07/08)渐入佳境
> **本文已收录到 [AndroidFamily](https://github.com/pengxurui/AndroidFamily),技术和职场问题,请关注公众号 [彭旭锐] 和 [BaguTree Pro] 知识星球提问。** - 往期回顾:[LeetCode 单周赛第 351 场 · 一 ......
LeetCode -- 352场周赛
思路:动态规划 首先计算原数组的条件数组,及所有的元素都%2 f[i]表示从零到i中选,且以第i项为结尾的最长奇偶子数组。 class Solution { public: int longestAlternatingSubarray(vector<int>& nums, int threshold ......
LeetCode 热题 100 之 49字母异位词分组
# 题目描述 给你一个字符串数组,请你将 字母异位词 组合在一起。可以按任意顺序返回结果列表。 字母异位词 是由重新排列源单词的所有字母得到的一个新单词。 示例 1: 输入: strs = ["eat", "tea", "tan", "ate", "nat", "bat"] 输出: [["bat"] ......
[Leetcode Weekly Contest]351
链接:[LeetCode](https://leetcode-cn.com/contest/weekly-contest-351/) ## [Leetcode]6451. 找出最大的可达成数字 给你两个整数 num 和 t 。 如果整数 x 可以在执行下述操作不超过 t 次的情况下变为与 num 相 ......
LeetCode 剑指 Offer 03. 数组中重复的数字
#题目链接:[LeetCode 剑指 Offer 03. 数组中重复的数字](https://leetcode.cn/problems/shu-zu-zhong-zhong-fu-de-shu-zi-lcof/) ##题意: 找出数组中重复的数字。 在一个长度为 n 的数组 nums 里的所有数字都 ......
python引入selenium报错ImportError: cannot import name 'webdriver' from partially initialized module 'selenium' (most likely due to a circular import)
背景: 新建一个名为:selenium.py的脚本文件,代码如下: from selenium import webdriver browser = webdriver.Chrome() browser.get('https://www.baidu.com/') 实现,我们已经通过pip insta ......
redis 报错 Can't chdir to './': Permission denied 解决方法
打开配置文件:sudo vim /etc/redis/reids.conf 找到配置:dir ./,把它改到有权限的目录即可,比如:/path/redis,或者新建一下目录,给redis读写权限。 ......
leetcode2095链表的删除操作
遇见中间节点就删除这个节点 可以用快慢指针 ListNode*fast=head; ListNode*slow=head; LiseNose*pre; whie(fast&&fast->next){//在这里中间节点是向下取整,因此可能会跳过一个节点,所以两个判断条件 fast=fast->next ......
ionic cordova 打包Rlease版本包出现异常Execution failed for task ':app:mergeReleaseResources'.java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2InternalException
异常: 解决方法: 找到android=》app 下的build.gradle文件,如下增加如下配置 运行ionic cordova build android --release打包语句正常执行 ......
Oracle数据库表中插入数据时报错:ORA-01536: 超出表空间 'USERS' 的空间限额
报错信息: Caused by: java.sql.BatchUpdateException: ORA-01536: 超出表空间 'USERS' 的空间限额 ORA-06512: 在 "CDDORM_MENJIN.PROC_DORM_MENJIN", line 11 ORA-06512: 在 "CD ......
LeetCode 215. 数组中的第K个最大元素
# 小根堆 ``` class Solution { public: int findKthLargest(vector& nums, int k) { priority_queue,greater> q; for(auto x:nums) { if(q.size()& nums, int k) { ......
mac解决pycharm运行报错NotOpenSSLWarning: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled
mac解决pycharm运行报错NotOpenSSLWarning: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled 第一步:卸载 urllib3 pip3 uninstall url ......
CodeForces 1847F The Boss's Identity
[洛谷传送门](https://www.luogu.com.cn/problem/CF1847F "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/1847/F "CF 传送门") 我们首先观察 $a$ 的形态。令题面中给出的 $ ......