![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
指针对撞
ChenD17
这个作者很懒,什么都没留下…
展开
-
leetcode-16-最接近的三数之和
//最前面多加一句判断(是否个数为3个),从超过59%升为超过99%,无语classSolution{public:intthreeSumClosest(vector<int>&nums,inttarget){if(nums.size()==3)returnnums[0]+nums[1]+nums[2];...原创 2020-06-28 09:47:56 · 89 阅读 · 0 评论 -
leetcode-18-四数之和
//三数外层套循环,由于考虑负数,判定条件需要改变(我直接删了 感觉复杂度好高)class Solution {public: vector<vector<int>> fourSum(vector<int>& nums, int target) { vector<vector<int>> res ...原创 2020-06-23 14:28:07 · 99 阅读 · 0 评论 -
leetcode-1-两数之和
bool cmp(pair<int, int> a, pair<int, int> b) { return (a.first < b.first);}class Solution {public: vector<int> twoSum(vector<int>& nums, int target) {...原创 2020-06-24 14:42:17 · 109 阅读 · 0 评论 -
leetcode-11-盛最多水的容器
class Solution {public: int CntArea(int i1, int i2, int val1, int val2){ return (i2 - i1)*(val1<val2? val1: val2); } int Cntmin(int i1, int i2, int val1, int val2){ ...原创 2020-06-24 14:42:41 · 120 阅读 · 0 评论 -
leetcode-345-反转字符串中的元音字母
bool helper(char ch) { if ((ch == 'a') || (ch == 'e') || (ch == 'i') || (ch == 'o') || (ch == 'u') || (ch == 'A') || (ch == 'E') || (ch ==...原创 2020-07-01 16:19:41 · 133 阅读 · 0 评论 -
leetcode-125-验证回文串
string char_type(char input) { if (input > 47 && input < 58) return "numbers"; else if (input > 64 && input < 91) return "LETTERS"; else if (input > 96 &am...原创 2020-06-24 14:44:06 · 88 阅读 · 0 评论