leetcode_101 icon indicating copy to clipboard operation
leetcode_101 copied to clipboard

LeetCode 101:和你一起你轻松刷题(C++)

Results 29 leetcode_101 issues
Sort by recently updated
recently updated
newest added

``` int numberOfArithmeticSlices(vector& nums) { int n = nums.size(); if (n < 3) return 0; vector dp(n, 0); for (int i = 2; i < n; ++i) { if (nums[i]...

有个疑惑,为什么作者没有发布在线版本呢?直接下载pdf文件到本地学习,有时候作者更新了内容也不知道。

于阅读过程中,发现诸多 typo,是否需要单独开一个 issue 供大家集中提交&讨论呢?

单独开一贴征集一些意见吧。 ================= 笔者自Waymo入职已一年有余,闲来重看此书,忽觉代码风格实在不够标准严谨。如果有空会按照[Google Code Style](https://google.github.io/styleguide/cppguide.html)重写一遍代码。 近来实在没有太多空闲时间,有时想写点别的书却抽不出时间。工作后确实很难在完成工作内容、锻炼身体、玩游戏之外再有余力。如果有长假期,可能考虑稍微写一些关于无人车的内容吧,在不泄露任何公司机密的情况下给各位读者介绍一下行业的现状。 另外如果你在读完此书后顺利通过面试而入职,又恰好在硅谷,请备注私信我,我请你吃炸鸡。

建议作者在贪婪法一章标明,证明一道题能用贪婪法解决,有时远比用贪婪法解决该题更复杂。。。 例如452. Minimum Number of Arrows to Burst Balloons这道题,当某个气球分别和另外两个气球有重叠区域时,很难直接理解为什么贪婪法的选择能奏效。说不定选择另一个重叠区域比选择当前重叠区域,最终使用的箭数更少呢? 感觉贪婪法的题目最终考察的是以前是否看过原题,否则除非是很简单的题目,否则短时间内很难想到是用贪婪法,或者说无法去证明能用贪婪法解决。

class Solution { public: int mySqrt(int x) { if(x == 0) return x; int left = 1, right = x; int mid, sqrt; while(left mid) left = mid + 1;...

class Solution { public: vector searchRange(vector& nums, int target) { if(nums.empty()) return vector{-1,-1}; int lower = lower_bound(nums, target); int upper = upper_bound(nums, target)-1; //if(nums[lower] != target || lower==nums.size()) return vector{-1,-1};...