Leetcode 0027.Remove Element(python)
27. Remove Element你选用何种方法解题?本题的核心是原地移除数组中等于给定值的元素。 方法选择理由: 快慢指针:只需一次遍历,空间复杂度 O(1) 解题过程问题分析输入:数组 nums,目标值 val输出:移除目标值后的数组长度 关键约束: 原地修改数组,不能使用额外空间 不需要保持元...
Leetcode 0026.Remove Duplicates from Sorted Array(python)
26. Remove Duplicates from Sorted Array你选用何种方法解题?本题的核心是原地删除有序数组中的重复元素。 方法选择理由: 快慢指针:只需一次遍历,空间复杂度 O(1) 解题过程问题分析输入:有序数组 nums输出:删除重复元素后的数组长度 关键约束: 原地修改数组,...
Leetcode 0025.Reverse Nodes in k-Group(python)
25. Reverse Nodes in k-Group题目Given the head of a linked list, reverse the nodes of the list k at a time, and return the modified list. k is a positive integ...
Leetcode 3002. Maximum Size of a Set After Removals
3002. Maximum Size of a Set After RemovalsYou are given two 0-indexed integer arrays nums1 and nums2 of even length n. You must remove n / 2 elements from nu...
Leetcode 0024.Swap Nodes in Pairs(python)
24. Swap Nodes in Pairs题目Given a linked list, swap every two adjacent nodes and return its head. You must solve the problem without modifying the values in t...
Leetcode 2356. 每位教师所教授的科目种类的数量
2356. 每位教师所教授的科目种类的数量表: Teacher 查询每位老师在大学里教授的科目种类的数量。 以 任意顺序 返回结果表。 查询结果格式示例如下。 示例 1: 解题思路核心思路是 “按教师分组,统计不重复的科目 ID”: 分组维度:按 teacher_id 分组(确保每个教师对应一条统计...
Leetcode 2356. 每位教师所教授的科目种类的数量
2356. 每位教师所教授的科目种类的数量表: Teacher 查询每位老师在大学里教授的科目种类的数量。 以 任意顺序 返回结果表。 查询结果格式示例如下。 示例 1: 解题思路核心思路是 “按教师分组,统计不重复的科目 ID”: 分组维度:按 teacher_id 分组(确保每个教师对应一条统计...
Leetcode 0023.Merge k Sorted Lists(python)
23. Merge k Sorted Lists题目You are given an array of k linked-lists lists, each linked-list is sorted in ascending order. Merge all the linked-lists into one ...
Leetcode 1934. 确认率
1934. 确认率表: Signups 表: Confirmations 用户的 确认率 是 'confirmed' 消息的数量除以请求的确认消息的总数。没有请求任何确认消息的用户的确认率为 0 。确认率四舍五入到 小数点后两位 。 编写一个SQL查询来查找每个用户的 确认率 。 ...
Leetcode 0022.Generate Parentheses(python)
22. Generate Parentheses题目Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. Example 1: Example 2: ...
Leetcode 1757. 可回收且低脂的产品
1757. 可回收且低脂的产品表:Products 编写解决方案找出既是低脂又是可回收的产品编号。 返回结果 无顺序要求 。 返回结果格式如下例所示: 示例 1: 解题思路核心思路是精准条件筛选: 明确筛选条件:同时满足 low_fats = 'Y'(低脂)和 recyclable ...
Leetcode 0021.Merge Two Sorted Lists(python)
21. Merge Two Sorted Lists题目You are given the heads of two sorted linked lists list1 and list2. Merge the two lists into one sorted list. The list should be ...
Leetcode 1201. Ugly Number III
1201. Ugly Number III题目Write a program to find the n-th ugly number. Ugly numbers are positive integers which are divisible by a or b or c. Example 1: Exam...
Leetcode 0020.Valid Parentheses(python)
20. Valid Parentheses题目Given a string s containing just the characters '(', ')', '{', '}', '[' and ']...
Leetcode 1193. 每月交易 I
1193. 每月交易 I表:Transactions 编写一个 sql 查询来查找每个月和每个国家/地区的事务数及其总金额、已批准的事务数及其总金额。 以 任意顺序 返回结果表。 查询结果格式如下所示。 示例 1: 解题思路核心思路是 “按月份 + 国家分组,用条件聚合统计指标”: 提取月...

