自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(11)
  • 资源 (1)
  • 收藏
  • 关注

原创 Leetcode Day13

151. 颠倒字符串中的单词【中等】https://leetcode-cn.com/problems/reverse-words-in-a-string/void reverse(char* s, int start, int end) { while (start < end) { char temp = s[start]; s[start++] = s[end]; s[end--] = temp; }}char * rever

2022-04-18 22:38:40 263

原创 Leetcode Day12

148. 排序链表【中等】https://leetcode-cn.com/problems/sort-list/class Solution {public: ListNode* sortList(ListNode* head) { return sortList(head, nullptr); } ListNode* sortList(ListNode* head, ListNode* tail) { if (head == nullptr)

2022-04-17 23:19:14 382

原创 Leetcode Day10

70. 爬楼梯【简单】https://leetcode-cn.com/problems/climbing-stairs/class Solution {public: int climbStairs(int n) { vector<int>dp(n+1, 0); dp[1] = 1; dp[0] = 1; for(int i=2; i<=n; i++) { dp[i] =

2022-04-15 23:58:18 335

原创 Leetcode day9

54. 螺旋矩阵【中等】https://leetcode-cn.com/problems/spiral-matrix/class Solution {public: vector<int> spiralOrder(vector<vector<int>>& matrix) { vector<int> ans; if(matrix.size()==0||matrix[0].size()==0)

2022-04-15 00:23:27 826

原创 Leetcode Day8

200. 岛屿数量【中等】https://leetcode-cn.com/problems/number-of-islands/class Solution {public: int ans=0; void dfs(int x, int y, vector<vector<char>>& grid) { if(x<0||y<0||x>=grid.size()||y>=grid[0].size())

2022-04-13 22:53:28 82

原创 Leetcode Day7

剑指 Offer 43. 1~n 整数中 1 出现的次数【困难】https://leetcode-cn.com/problems/1nzheng-shu-zhong-1chu-xian-de-ci-shu-lcof/class Solution {public: int countDigitOne(int n) { int low=0; int cur; int high=n; int num=1; int ans

2022-04-12 23:54:37 229

原创 Leetcode Day6

415. 字符串相加【简单】https://leetcode-cn.com/problems/add-strings/模拟class Solution {public: string addStrings(string num1, string num2) { int len1 = num1.size(); int len2 = num2.size(); int add=0; string ans=""; f

2022-04-11 20:16:30 72

原创 Leetcode day5

剑指 Offer 14- I. 剪绳子【中等】https://leetcode-cn.com/problems/jian-sheng-zi-lcof/dfsclass Solution {public: int ans=-1; void dfs(int cur, int n, int tmp, int last) { if(cur==n) { ans=max(ans,tmp); return;

2022-04-10 22:42:22 87

原创 Leetcode Day4

121买卖股票的最佳时机【简单】https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock/简单dpclass Solution {public: int maxProfit(vector<int>& prices) { vector<int> dp(prices.size()+1, 10001); //dp[i]=i前最小的 int re

2022-04-09 22:41:34 784

原创 Leetcode Day3

1.两数之和【简单】https://leetcode-cn.com/problems/two-sum/哈希class Solution {public: vector<int> twoSum(vector<int>& nums, int target) { unordered_map<int,int> mp; for(int i=0; i<nums.size(); i++) {

2022-04-08 23:04:01 337

原创 Leetcode Day1

4.653.最大子数组和【简单】https://leetcode-cn.com/problems/maximum-subarray/贪心:如果一段的和小于0直接舍弃class Solution {public: int maxSubArray(vector<int>& nums) { int maxx = nums[0]; int sum = 0; for(int i=0; i<nums.size(); i++)

2022-04-06 20:39:37 75

test.py

test.py

2021-12-03

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除