leetcode 240 搜索二维矩阵ii-爱代码爱编程
搜索二维矩阵II 高刷题 class Solution { public: bool searchMatrix(vector<vector<int>>& matrix, int
代码编织梦想
搜索二维矩阵II 高刷题 class Solution { public: bool searchMatrix(vector<vector<int>>& matrix, int
最长连续序列 高刷题 class Solution { public: int longestConsecutive(vector<int>& nums) { if(num
螺旋矩阵 高频题 class Solution { public: vector<int> spiralOrder(vector<vector<int>>& ma
合并两个有序数组 class Solution { public: void merge(vector<int>& nums1, int m, vector<int>&
二叉树的最大路径和 高频题 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNod
排序数组 冒泡排序 class Solution { public: vector<int> sortArray(vector<int>& nums) { for(
LRU缓存 链表法(超时) class LRUCache { public: list<pair<int,int>> my_list; int max_size = 0;
搜索旋转排序数组 遍历法 class Solution { public: int search(vector<int>& nums, int target) { for(
二叉树的锯齿形层序遍历 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *l
合并两个有序链表 /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next
买卖股票的最佳时机 贪心算法 核心思想是找到利润。然后利润大于0的相加 class Solution { public: int maxProfit(vector<int>& price
最大子数组和 贪心算法 class Solution { public: int maxSubArray(vector<int>& nums) { int
滑动窗口最大值 在滑动窗口移动过程中,记录每一个时间窗口的最大值 设计一个单调队列类型,用双向数组构造。 单调队列的功能是可以实时返回最大值。 class Solution { public: vector
二叉树的最大深度 层次遍历 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode
对称二叉树 对称二叉树核心是对比左子树和右子树是否对称。 即 外侧 左子树的左和右子树的右 ; 内侧 左子树的右和右子树的左 /** * Definition for a binary tree node. *
翻转二叉树 广度搜索法 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *
验证IP地址 高刷题 class Solution { public: bool cheakIP4(vector<string> &tmpIP4) { if(tmp
和为k的自数组 高刷题(暴力超时) class Solution { public: int subarraySum(vector<int>& nums, int k) {
最大数 高刷题 class Solution { public: static bool cmp( string &s1 , string &s2 ) { string
寻找选择排序数组中的最小值 高频题 在这里插入代码片![class Solution { public: int findMin(vector<int>& nums) {