摘要: leetcode刷了600多题啦,最近会放缓刷题速度(具体而言,就是只打周赛),开始看C++相关内容。 该内容近短时间内将持续更新,但本身没啥技术含量,因为只是我个人的笔记而已。 内容:C++ Primer / Effective C++ 运算符重载 重载运算符函数的参数数量与该运算符作用的运算对象 阅读全文
posted @ 2019-09-09 20:33 fish1996 阅读(443) 评论(0) 推荐(0) 编辑
摘要: 刷了两个半月leetcode,成果如下,以medium为主,加了一些hard。easy不少都是比赛中做的,接下来可能不会大量刷新题了,开始进入总结阶段。总结还未开始,本篇文章先占一个坑。 2020年3月19日更新:本文是去年七月的时候写的,最近我又开始刷题了,so,这篇文章继续更新,更新了一下lee 阅读全文
posted @ 2019-08-04 21:33 fish1996 阅读(9013) 评论(2) 推荐(2) 编辑
摘要: problem : https://leetcode.com/problems/lru-cache/ 这道题的想法是维护三个数组,一个data记录实际的key-value数据,一个LRU的list记录LRU数据,一个pos记录每个数字所在的链表的位置。 对于LRU而言,每次访问到了出现过的数字,我们 阅读全文
posted @ 2020-03-19 21:42 fish1996 阅读(145) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/problems/longest-well-performing-interval/ 将满足条件的视为+1,不满足的视为-1,计算前缀和。该题可以转换为计算和大于0的最小区间。 class Solution { public: int longestWPI( 阅读全文
posted @ 2020-02-08 00:53 fish1996 阅读(174) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/problems/implement-queue-using-stacks 使用堆栈实现队列。 使用两个堆栈,push的时候正常放入堆栈1,pop的时候,如果堆栈2为空,就把堆栈1的数据全部放入堆栈2(此时数据就倒序了),这时候从堆栈2的顶部就能取到最早进入 阅读全文
posted @ 2019-10-26 13:41 fish1996 阅读(98) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/contest/biweekly-contest-11/problems/divide-chocolate/ 这道题的题目意思就是,一个巧克力有n格,每个格子有不同的甜度,将巧克力切k次,选择甜度最低的那块,问怎么切能够使得甜度最低的那块巧克力甜度最大。 比 阅读全文
posted @ 2019-10-26 13:14 fish1996 阅读(2163) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/problems/maximum-equal-frequency/ 阅读全文
posted @ 2019-10-13 12:11 fish1996 阅读(269) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/contest/weekly-contest-154/problems/critical-connections-in-a-network/ 阅读全文
posted @ 2019-09-15 13:49 fish1996 阅读(981) 评论(0) 推荐(0) 编辑
摘要: problem: https://leetcode.com/problems/robot-bounded-in-circle/ As the hint mentions, we can keep track of the robot's position, when it finally retur 阅读全文
posted @ 2019-08-18 20:02 fish1996 阅读(153) 评论(0) 推荐(0) 编辑
摘要: problem: https://leetcode.com/problems/knight-probability-in-chessboard/ This is an easy problem using dfs. 阅读全文
posted @ 2019-08-17 23:58 fish1996 阅读(90) 评论(0) 推荐(0) 编辑
摘要: problem: https://leetcode.com/problems/advantage-shuffle/ In ordered to maximize the advantage of array A with respect to B, we had better choose the 阅读全文
posted @ 2019-08-17 23:39 fish1996 阅读(120) 评论(0) 推荐(0) 编辑