240. 搜索二维矩阵 II - 力扣(LeetCode)
class Solution {
public:bool searchMatrix(vector<vector<int>>& matrix, int target) {int i = matrix.size() - 1, j = 0;while(i >= 0 && j < matrix[0].size()){if(matrix[i][j] > target) i--;else if(matrix[i][j] < target) j++;else return true;}return false;}
};
class Solution {
public:ListNode* mergeTwoLists(ListNode* list1, ListNode* list2) {ListNode* dum = new ListNode(0);ListNode* cur = dum;while (list1 != nullptr && list2 != nullptr) {if (list1->val < list2->val) {cur->next = list1;list1 = list1->next;}else {cur->next = list2;list2 = list2->next;}cur = cur->next;}cur->next = list1 != nullptr ? list1 : list2;return dum->next;}
};