2025年3月24日

摘要: https://nodejs.org/en/download 阅读全文
posted @ 2025-03-24 19:47 TMatrix52 阅读(8) 评论(0) 推荐(0)

2025年3月12日

摘要: class Solution { public: int divide(int dividend, int divisor) { // 处理特殊情况 if (divisor == 1) return dividend; if (divisor == -1) { if (dividend == INT 阅读全文
posted @ 2025-03-12 15:11 TMatrix52 阅读(9) 评论(0) 推荐(0)
摘要: https://leetcode.cn/problems/ZL6zAn/ class Solution { public: void DFS(vector<vector<int>>& grid, int i, int j, int M, int N, int& sum) { if (grid[i][ 阅读全文
posted @ 2025-03-12 11:18 TMatrix52 阅读(11) 评论(0) 推荐(0)

2025年3月11日

摘要: int removeElement(vector<int>& nums, int val) { int slow = 0; for (int fast = 0; fast < nums.size(); ++fast) { if (nums[fast] != val) { nums[slow++] = 阅读全文
posted @ 2025-03-11 17:38 TMatrix52 阅读(8) 评论(0) 推荐(0)
摘要: /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : 阅读全文
posted @ 2025-03-11 16:44 TMatrix52 阅读(12) 评论(0) 推荐(0)

2025年2月22日

摘要: /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), rig 阅读全文
posted @ 2025-02-22 20:08 TMatrix52 阅读(6) 评论(0) 推荐(0)

2025年2月17日

摘要: class Solution { public: bool isSubsequence(string s, string t) { // 公共子序列是不是s 长度相同 // dp[i][j] 表示以下标i-1为结尾的字符串s,和以下标j-1为结尾的字符串t,相同子序列的长度为dp[i][j]。 // 阅读全文
posted @ 2025-02-17 19:50 TMatrix52 阅读(7) 评论(0) 推荐(0)

2025年1月26日

摘要: https://leetcode.cn/problems/unique-paths-ii/ class Solution { public: int uniquePathsWithObstacles(vector<vector<int>>& obstacleGrid) { int m = obsta 阅读全文
posted @ 2025-01-26 18:25 TMatrix52 阅读(11) 评论(0) 推荐(0)
摘要: class Solution { public: int uniquePaths(int m, int n) { // 二维dp数组 vector<vector<int> >dp(m, vector<int>(n, 0)); //初始化 for (int j = 0; j<n; j++) { dp[ 阅读全文
posted @ 2025-01-26 17:59 TMatrix52 阅读(9) 评论(0) 推荐(0)

2025年1月25日

摘要: class Solution { public: int minCostClimbingStairs(vector<int>& cost) { // dp[i] 为选择下标为i的台阶向上爬,所需要的最低花费 // dp[i] = min(dp[i-2] + cost[i-2], dp[i-1] + 阅读全文
posted @ 2025-01-25 17:19 TMatrix52 阅读(12) 评论(0) 推荐(0)

导航