This website is used to record the process of solving problems inLeetCode. On the one hand, I can develop a habit of solving problems, on the other hand, I can motivate myself to challenge difficulties one after another. If you are interested in it, please join us!
This repository contains the solutions and explanations to the algorithm problems on LeetCode. Only medium or above are included. All are written in C++/Python and implemented by myself. The problems attempted multiple times are labelled with hyperlinks. Topics algorithms leetcode cpp Resources Re...
https://leetcode-cn.com/problems/house-robber/solution/yu-ni-yi-qi-xue-suan-fa-python3-shi-xian-knk6/ https://leetcode-cn.com/problems/house-robber-ii/solution/yu-ni-yi-qi-xue-suan-fa-python3-shi-xian-ifpb/ https://leetcode-cn.com/problems/house-robber/solution/da-jia-jie-she-by...
只需要使用常数个额外变量 代码(Python3) class Solution: def kthSmallest(self, matrix: List[List[int]], k: int) -> int: n: int = len(matrix) # 取出矩阵中最小和最大的数字,分别作为二分区间的左右边界 l: int = matrix[0][0] r: int = matrix[n - 1][n - 1] # 运用二分找到最小...
提交代码 :本项目统一使用C++语言进行讲解,但已经有Java、Python、Go、JavaScript等等多语言版本,感谢这里的每一位贡献者,如果你也想贡献代码点亮你的头像,点击这里了解提交代码的方式。 转载须知 :以下所有文章皆为我(程序员Carl)的原创。引用本项目文章请注明出处,发现恶意抄袭或搬运,会动用法律武器维护自己的权益。
349. 两个数组的交集这道题目,主要要学会使用一种哈希数据结构:unordered_set,这个数据结构可以解决很多类似的问题。
350+Problems / 1000+Solutions 最好不要满足于accept,要追求最高效率。做一题就要杀死一题。leetcod...
Python:def test_1_wei_bag_problem(): weight = [1, 3, 4] value = [15, 20, 30] bag_weight = 4 # 初始化: 全为0 dp = [0] * (bag_weight + 1) # 先遍历物品, 再遍历背包容量 for i in range(len(weight)): for j in range(bag_weight, weight[i] - 1, -1): # 递归公式 ...
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
公司航班预订 - Leetcode 1109 [difference_array] 寻找最佳价值。 最接近目标的变异数组的总和。 [binary_search] K 离原点最近的点 [快速排序] 将 2D 列表旋转 90 度 字符串 非重复字符。 单向字符串。 比较严格较小的字符串 匹配括号 数数说 编码号码 - Leetcode 1256 图表 在扫雷中分配数字 查找扫雷艇...