determine leetcode conflict events
LeetCode 152. 乘积最大子数组
原题解 ###题目 约束 ###题解 class Solution { public: int maxProduct(vector<int>& nums) { int maxF = nums[0], minF = nums[0], ans = nums[0]; for (int i = 1; i < ......
[LeetCode] 2336. Smallest Number in Infinite Set
You have a set which contains all positive integers [1, 2, 3, 4, 5, ...]. Implement the SmallestInfiniteSet class: SmallestInfiniteSet() Initializes t ......
[LeetCode] 2418. Sort the People
You are given an array of strings names, and an array heights that consists of distinct positive integers. Both arrays are of length n. For each index ......
【LeetCode动态规划#13】买卖股票含冷冻期(状态众多,比较繁琐)、含手续费
最佳买卖股票时机含冷冻期 力扣题目链接(opens new window) 给定一个整数数组,其中第 i 个元素代表了第 i 天的股票价格 。 设计一个算法计算出最大利润。在满足以下约束条件下,你可以尽可能地完成更多的交易(多次买卖一支股票): 你不能同时参与多笔交易(你必须在再次购买前出售掉之前的 ......
LeetCode 1643. 第 K 条最小指令
康托展开 一开始无脑枚举全排列, 果断超时, 还是得看看如果降低计算量。 题目destination = [2,3], 相当于2个V, 3个H, 输出全排列去重后的对应位置字典序列内容。 忽略去重 则问题为全排列, 所有可能为: $$ (\sum destination)! = (2+3)! = 5 ......
leetcode调研version0
这是我第一次发博客,所以许多功能还不太会使用。前几次的随笔既当作记录,也当作自己的练习。 最近想要刷leetcode,纠结用哪种语言(我自己学过c/c++, python, fortran, Java),所以前期做了一些调研,在此记录一下。 c语言: 网址:https://github.com/be ......
leetcode 607 銷售員
銷售員 select s.`name` from salesperson s left join orders o on s.sales_id=o.sales_id left join company c on o.com_id=c.com_id and c.name='RED' group by ......
UI Events
UI Events(用户交互事件)是指在计算机操作系统、应用程序或网页上用户与界面之间的交互过程中发生的事件。在前端开发中,UI Events是非常重要的一部分,因为它们可以帮助开发者实现更好的用户体验。 以下是一些常见的UI Events: 鼠标点击:当用户在界面上单击鼠标时会触发此事件。你可以使 ......
leetcode 595 大的國家
大的國家 select `name`, population, area from World where area >= 3000000 or population >= 25000000 ......
【DP】LeetCode 213. 打家劫舍 II
题目链接 213. 打家劫舍 II 思路 分析动态规划题目的时候只需要考虑最后一个阶段,因为所有的阶段转化都是相同的,考虑最后一个阶段容易发现规律 在数组的动态规划问题中,一般 dp[i] 都是表示以 nums 以前 i 个元素组成(即 nums[i - 1])的状态;dp[i][j] 分别表示以 ......
leetcode 586 訂單最多的客戶
訂單最多的客戶 select customer_number from Orders group by customer_number having count(order_number) = ( select count(order_number) from Orders group by cus ......
leetcode 584 尋找用戶推薦人
尋找用戶推薦人 select name from customer where referee_id <> 2 or referee_id is null ......
leetcode 570 至少有5名直接下屬的經理
至少有5名直接下屬的經理 子查詢 select `name` from Employee where id in ( select managerId from Employee group by managerId having count(managerId) >= 5 ) 自連接 select ......
[LeetCode] 1342. Number of Steps to Reduce a Number to Zero 将数字变成 0 的操作次数
Given an integer num, return the number of steps to reduce it to zero. In one step, if the current number is even, you have to divide it by 2, otherwi ......
【DP】LeetCode 198. 打家劫舍
题目链接 198. 打家劫舍 思路 分析动态规划题目的时候只需要考虑最后一个阶段,因为所有的阶段转化都是相同的,考虑最后一个阶段容易发现规律 在数组的动态规划问题中,一般 dp[i] 都是表示以 nums 以前 i 个元素组成(即 nums[i - 1])的状态;dp[i][j] 分别表示以 num ......
【DP】LeetCode 1277. 统计全为 1 的正方形子矩阵
题目链接 1277. 统计全为 1 的正方形子矩阵 思路 分析动态规划题目的时候只需要考虑最后一个阶段,因为所有的阶段转化都是相同的,考虑最后一个阶段容易发现规律 在数组的动态规划问题中,一般 dp[i] 都是表示以 nums 以前 i 个元素组成(即 nums[i - 1])的状态;dp[i][j ......
LeetCode 148. 排序链表
前置题目 21. 合并两个有序链表 原题解 ###题目 约束 ###题解 ####方法一 class Solution { public: ListNode* sortList(ListNode* head) { return sortList(head, nullptr); } ListNode* ......
【LeetCode动态规划#12】详解买卖股票I~IV,经典dp题型
买卖股票的最佳时机 力扣题目链接(opens new window) 给定一个数组 prices ,它的第 i 个元素 prices[i] 表示一支给定股票第 i 天的价格。 你只能选择 某一天 买入这只股票,并选择在 未来的某一个不同的日子 卖出该股票。设计一个算法来计算你所能获取的最大利润。 返 ......
leetcode 550 游戏玩法分析IV
游戏玩法分析 select round(avg(a.event_date is not null), 2) as fraction from (select player_id, min(event_date) as event_date from activity group by player_ ......
Leetcode 15. 三数之和 Python题解
来源:力扣(LeetCode) 链接:https://leetcode.cn/problems/3sum 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 1. 排序+双指针 解题思路: 一开始想到暴力破解法,使用三重循环寻找和为0的3个元素,在此期间使用集合来去重。这样做的时间 ......
【DP】LeetCode 221. 最大正方形
题目链接 221. 最大正方形 思路 分析动态规划题目的时候只需要考虑最后一个阶段,因为所有的阶段转化都是相同的,考虑最后一个阶段容易发现规律 在数组的动态规划问题中,一般 dp[i] 都是表示以 nums 以前 i 个元素组成(即 nums[i - 1])的状态;dp[i][j] 分别表示以 nu ......
LeetCode 周赛 342(2023/04/23)容斥原理、计数排序、滑动窗口、子数组 GCB
本文已收录到 AndroidFamily,技术和职场问题,请关注公众号 [彭旭锐] 提问。 大家好,我是小彭。 前天刚举办 2023 年力扣杯个人 SOLO 赛,昨天周赛就出了一场 Easy - Easy - Medium - Medium 的水场,不得不说 LeetCode 是懂礼数的 😁。 接 ......
leetcode343. 整数拆分
class Solution { public: int f[60];//f[i]记录i能拆出的最大乘积 int integerBreak(int n) { for(int i=2;i<=n;i++) for(int j=1;j<i;j++)//枚举最后一个拆出的数字,这里不能只循环到i/2 f[i ......
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts
01、报错如下: 02、解决方法: python -m pip install --upgrade pip ......
leetcode377.组合总和IV
class Solution { public: long long f[1010];//f[i]表示总和为i的选法个数 int combinationSum4(vector<int>& nums, int target) { int n=nums.size(); f[0]=1; for(int i ......
leetcode 511 游戏玩法分析 I
游戏玩法分析 select player_id , min(event_date) as first_login from Activity group by player_id order by player_id asc == ......
Leetcode 88. 合并两个有序数组 Python题解
来源:力扣(LeetCode) 链接:https://leetcode.cn/problems/merge-sorted-array 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 1.暴力法 解题思路:由于题目要求原地合并,直接返回nums1数组。因此一个可行的方案是合并两个 ......
Node.js Event Loop & V8 engine & libuv All In One
Node.js Event Loop & V8 engine & libuv All In One
事件循环
......
leetcode 262 行程和用戶
行程和用戶 SELECT t.`request_at` AS `Day`, ROUND(SUM(IF(t.status = 'completed', 0, 1))/COUNT(t.status) ,2) AS `Cancellation Rate` FROM Trips AS t LEFT JOIN ......