随笔分类 - LeetCode
LeetCode每日一题
摘要:// S = min(a, b) * (j - i) // j-i一直变小! a,b里面 移动大的一边, min(a, b)可能变小或不变! 移动小的一边, min(a, b)可能变小或变大! // 所以只需要 一直移动小的一边! class Solution { public: int maxAr
阅读全文
摘要:我的题解表现: class Solution { public: int myAtoi(string s) { int ret = 0; if (s.size() == 0){ return ret; } const char*p = s.c_str(); int i = 0; while(p[i]
阅读全文
摘要:class Solution { public: string longestPalindrome(string s) { if (s.size() <= 1){ return s; } int a = 0; //记录临时值 int length = 0; int ta = 1; //滑动窗口边界
阅读全文
摘要:class Solution { public: int lengthOfLongestSubstring(string s) { if (s.size() == 0){ return 0; } int ret = 0; int tlength = 1; bool flag = false; //匹
阅读全文
摘要:/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) :
阅读全文
摘要:还是觉得有必要坚持刷leetcode 在这里打卡。 加油。 这是第一遍 很惭愧。做这一行这么久 才开始刷力扣。但是开始了总是好的。尽管代码丑,但是至少都是能通过的吧。 1、 Total Accepted: 159385 Total Submissions: 822358 Difficulty: Me
阅读全文