最大值leetcode日记1881
【LeetCode 2701. 连续递增交易】MySQL用户变量编程得到严格递增连续子序列的开始位置,结束位置,长度等统计信息
题目地址 https://leetcode.cn/problems/consecutive-transactions-with-increasing-amounts/ 代码 # Write your MySQL query statement below with t1 as( select * # ......
【Leetcode 2474. 购买量严格增加的客户】MySQL用户变量编程解决严格递增连续子序列问题
题目地址 https://leetcode.cn/problems/customers-with-strictly-increasing-purchases/description/ 代码 # Write your MySQL query statement below with t1 as( se ......
【LeetCode 2494. 合并在同一个大厅重叠的活动】MySQL用户变量编程解决区间合并问题
题目地址 https://leetcode.cn/problems/merge-overlapping-events-in-the-same-hall/ 代码 # Write your MySQL query statement below with t2 as( select * # 只需要改动这 ......
【LeetCode1747. 应该被禁止的 Leetflex 账户】MySQL用户变量编程;尝试维护一个multiset
题目地址 https://leetcode.cn/problems/leetflex-banned-accounts/description/ 代码 with t1 as( select account_id,ip_address, login as tick, "login" as mytype ......
【Leetcode1949. 坚定的友谊】使用MySQL在无向图中寻找{"CompleteTripartite", {1, 1, 3}}这个pattern
题目地址 https://leetcode.cn/problems/strong-friendship/ 思路 就是在无向图中寻找这个pattern: (* Mathematica *) GraphData[{"CompleteTripartite", {1, 1, 3}}] SQL写还是比较麻烦。 ......
【LeetCode 2142. 每辆车的乘客人数 I】乘客到站等车,车到站载客。MySQL用户变量编程完成
题目地址 https://leetcode.cn/problems/the-number-of-passengers-in-each-bus-i/description/ 思路 将所有关键时刻作为tick。(同一时刻车和人同时到,默认人在车前到) 之后按照tick升序,使用MySQL用户变量编程完成 ......
threading库设置最大线程
问题描述 在使用python的threading库时,希望如何设置最大线程数N_max 从而确保当python开启的线程数超过N_max时,将暂停程序; 直到前面的线程结束后,再开始新的线程 解决方案 import threading import time # 定义工作函数 def worker( ......
吴师兄学算法day06 双指针 485. 最大连续 1 的个数
题目:485. 最大连续 1 的个数 易错点: 代码示例: class Solution: def findMaxConsecutiveOnes(self, nums: List[int]) -> int: cnt = 0 max_cnt = 0 for i in nums: if i == 1: ......
【LeetCode 】练习str_to_date函数;over(rows between CURRENT ROW AND 2 following)实现【当月和接下来2个月】滑动窗口
题目地址 https://leetcode.cn/problems/hopper-company-queries-iii/description/ 代码 -- CTE生成2020年每月的最后一天 WITH RECURSIVE months AS ( SELECT LAST_DAY('2019-12- ......
09-找到社会意愿 和要求的最大公约数
进一步思考 “给定资料 5” 中划线句子 “有事好商量, 众人的事情由众人商量,找到全社会意愿和要求的最大公约数”, 参考给定资料, 自选角度, 自拟题目, 写一篇文章。 (40 分)要求: (1) 观点明确, 立意深刻; (2) 思路清晰, 语言流畅; (3) 结合 “给定资料”, 但不拘泥于 “ ......
leetcode 15.三数之和
leetcode 15.三数之和 第十五题:三数之和 1.排序 + 双指针: 和两数之和不同,但可以转化为类似的思路,即确定一个数,去找数组中是否有另外两个数之和等于它的相反数。本题的难点在于如何去除重复解,如果是无序数组,则需要对每个值所在的位置进行记录并进行比较。但如果是有序数组且相加结果为0, ......
[LeetCode] 2085. Count Common Words With One Occurrence
Given two string arrays words1 and words2, return the number of strings that appear exactly once in each of the two arrays. Example 1: Input: words1 = ......
【LeetCode 1635. Hopper 公司查询 I】with recursive生成2020年每月的最后一天
题目地址 https://leetcode.cn/problems/hopper-company-queries-i/description/ 代码 -- CTE生成2020年每月的最后一天 WITH RECURSIVE months AS ( SELECT LAST_DAY('2019-12-01 ......
SQL 分组统计 最大值
group by having max 参考:https://blog.51cto.com/u_16213600/6983022 参考2:https://www.cnblogs.com/2008nmj/p/16628913.html SELECT xxx,min(bbb) FROM "table1" ......
【LeetCode 2854. 滚动平均步数】MySQL过去n日滑动窗口
题目地址 https://leetcode.cn/problems/rolling-average-steps/description/ 代码 WITH t1 AS ( SELECT user_id, steps_date, CASE WHEN COUNT(steps_count) OVER ( P ......
【LeetCode 2989. 班级表现】T-SQL 动态sql编程示例
题目地址 https://leetcode.cn/problems/class-performance/description/ 题目大意 编写一个查询,计算学生获得的 最高分 和 最低分 之间的 总分差(3 次作业的总和)。 代码 /* Write your T-SQL query stateme ......
代码随想录 day16 N 叉树的最大深度 完全二叉树的节点个数
N 叉树的最大深度 这题昨天做过二叉版本 n叉区别不大 完全二叉树的节点个数 层级遍历 入que的数量就是节点个数 ......
【LeetCode 2994. 发生在周五的交易 II】with recursive生成2023-11月所有周五的日期
题目地址 https://leetcode.cn/problems/friday-purchases-ii/description/ 代码 # Write your MySQL query statement below WITH RECURSIVE Fridays (week_of_month, ......
【LeetCode2993. 发生在周五的交易 I】MySQL里尝试实现weekofmonth功能
题目地址 https://leetcode.cn/problems/friday-purchases-i/description/ 代码 # Write your MySQL query statement below with t1 as( SELECT *, DAYOFMONTH(purchas ......
二分图最大匹配学习总结
二分图最大匹配学习总结 二分图的定义 如果无向图 \(G=(V,E)\) 的点集 \(V\) 可以分为两个集合 \(V_1,V_2\),使边集 \(E\) 都在 \(V_1\) 和 \(V_2\) 之间,并且 \(V_1\) 和 \(V_2\) 内部的点没有连边,则 \(G\) 是一个二分图。 图例 ......
shader 一步一步 日记累月 ----极坐标
学习shader 就是在考察 数学知识极坐标 复习一下极坐标的点的位置是靠theta(角度)和r(距离)两个信息(二维空间) shader: // 直角坐标转极坐标方法 float2 RectToPolar(float2 uv, float2 centerUV) { uv = uv - center ......
vue使用flexible.js 最大宽度只有540
分辨率大于540px的时候,flexible限制为540,一般的手机显示没有问题,但对于大于540的竖屏屏幕,可能右边就会留白。我想让横屏的时候限制在540,竖屏的时候根据页面实际宽度自适应,解决方法如下: 1、安装 npm install lib-flexible --save 2、为了避免每次安 ......
[LeetCode] 1363. Largest Multiple of Three 形成三的最大倍数
Given an array of digits digits, return the largest multiple of three that can be formed by concatenating some of the given digits in any order. If th ......
day 1 LeetCode刷题日志
今天的内容是 704 和 27 ovo 704. 二分查找 给定一个 n 个元素有序的(升序)整型数组 nums 和一个目标值 target 写一个函数搜索 nums 中的 target,如果目标值存在返回下标,否则返回 -1 Myself C: //左闭右闭 [0,1,2,3] int searc ......
springboot学习日记(八)
前后端分离的项目static目录下一般不存放东西。static目录下的图片等资源默认做了映射,直接在localhost:8080下访问即可。 表单中的enctype属性决定了服务器对表单数据的编码,将该属性设置成form-data时可以通过filename找到路径,用content-type设置内容 ......
leetcode 11.盛最多水的容器
leetcode 11.盛最多水的容器 第十一题:盛最多水的容器 1.暴力枚举: 会超时,但是做一些条件判断应该可以擦边过 public int maxArea(int[] height) { int max_result = 0; for (int i = 0;i<height.length-1; ......
[LeetCode] 2696. Minimum String Length After Removing Substrings
You are given a string s consisting only of uppercase English letters. You can apply some operations to this string where, in one operation, you can r ......
代码随想录 day13 滑动窗口最大值 前 K 个高频元素
滑动窗口最大值 这题第一次见 比较难找到思路 滑动窗口的移动比较类似于队列的行为 但是我们需要找到其中的最大值 在线性时间复杂度下 只能维护这个队列保持单调性 但是我们没有这样的一个可以在移动中保持单调的数据结构 只能自己手动创建 我们利用deque进行队列的创建 这个队列有三个基本函数 pop 用 ......
LeetCode 872
Leaf-Similar Trees Leaf-Similar Trees - LeetCode Thinkings 二叉树无论先中后序遍历,所得叶子节点次序不变. Codes 我采用了非递归的中序遍历方式: /** * Definition for a binary tree node. * st ......