Lesson 74 What did they do? 词汇 hurriedly adv. 匆忙地 构成:hurry v. 匆忙的 hurried a. 着急的 -ly:形容词尾+ly,通常变成副词 用法:hurry to + 地点 着急去…… 近义词:quick a. 快的 quickly ad. 快地 例句:他着急忙慌去了学校。 He went to school
题意: 从一个二维数组中找出是否存在某一个值,数组特征,每一行从左到右依次增大并且下一行的第一个数字大于上一行的最后一个数字 思路: 不知道直接暴力能不能过,不过可以想到,利用数组的特征,将目标数字与每一行末尾的数字进行比较能够找到目标数字所在的行,然后在遍历该行即可,时间复杂度O(m+n) 代码: public boolean searchMatrix(int[][] matrix, in
思路: 直接排序是可以的,但是时间复杂度不符合。可以使用优先队列,代码如下: class Solution {public int findKthLargest(int[] nums, int k) {if (nums==null||nums.length==0||k<0||k>nums.length){return Integer.MAX_VALUE;}PriorityQueue<Int
题目: Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted from left to right.The first integer of
题目描述 题目难度:Medium Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted from left to right. The first in