![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
LeetCode 题解
bestination
这个作者很懒,什么都没留下…
展开
-
链表的快速排序
面试常见问题原创 2020-09-15 16:07:27 · 1428 阅读 · 0 评论 -
Python 快速幂
def fastPower(base, power): res = 1 while power > 0: if power % 2 == 1: res *= base power = power >> 1 base *= base return res原创 2020-08-03 13:59:10 · 301 阅读 · 3 评论 -
有序矩阵中的第 k 个最小数组和(小堆栈)
本题是来自力扣(leetcode)第187场周赛的第四题,也就是一道压轴题目,hard难度。先附上题目链接:https://leetcode-cn.com/problems/find-the-kth-smallest-sum-of-a-matrix-with-sorted-rows/还有我的灵感来源:reference:https://leetcode-cn.com/proble...原创 2020-05-04 18:57:16 · 444 阅读 · 0 评论 -
合并K个排序链表(小堆栈)
本题是一个力扣 hard 难度题目,下面是题目链接:https://leetcode-cn.com/problems/merge-k-sorted-lists/合并k个排序链表,返回合并后的排序链表。请分析和描述算法的复杂度。示例:输入:[ 1->4->5, 1->3->4, 2->6]输出: 1->1->2->...原创 2020-05-01 20:32:29 · 194 阅读 · 0 评论 -
二叉树的最近公共祖先(DFS,递归)
本题是来自 leetcode 的一道中等难度的题目。先把题目连接贴上:https://leetcode-cn.com/problems/lowest-common-ancestor-of-a-binary-tree/https://leetcode-cn.com/problems/er-cha-shu-de-zui-jin-gong-gong-zu-xian-lcof/给定一个二叉树,...原创 2020-04-30 21:27:27 · 263 阅读 · 0 评论 -
力扣(LeetCode)322. 零钱兑换(动态规划)(类似完全背包问题)
本题是来自力扣(LeetCode)一道中等难度的问题。用动态规划求解非常巧妙,同样背包问题也是笔试中的高频问题,本人现在还在研究之中,先把这道题搞懂分享给大家,希望大家共同进步。题目链接:https://leetcode-cn.com/problems/coin-change/题目:给定不同面额的硬币 coins 和一个总金额 amount。编写一个函数来计算可以凑成总金额所需的最少的硬币个数。如果没有任何一种硬币组合能组成总金额,返回-1。示例1:输入: coins = [1, ..原创 2020-05-09 17:44:51 · 402 阅读 · 0 评论