上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 44 下一页
摘要: 问题: 给定一个数组A,求得连续元素组成子数组最大值在L和R之间的子数组个数。 Example : Input: A = [2, 1, 4, 3] L = 2 R = 3 Output: 3 Explanation: There are three subarrays that meet the r 阅读全文
posted @ 2020-05-10 19:12 habibah_chang 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定一个字符串S,和一个词组集合words,返回words里的字符串为S的不连续字串的个数。 Example : Input: S = "abcde" words = ["a", "bb", "acd", "ace"] Output: 3 Explanation: There are thr 阅读全文
posted @ 2020-05-10 15:37 habibah_chang 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定一个由0,1组成的N*N的数组,问是否能进行多次行交换,列交换,使得数组成为一个国际象棋盘(01交叉排列) 可以则返回交换次数,否则返回-1 Examples: Input: board = [[0,1,1,0],[0,1,1,0],[1,0,0,1],[1,0,0,1]] Output 阅读全文
posted @ 2020-05-09 16:14 habibah_chang 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定一个由【0~N-1】组成的一个排列数组。 local降序:相邻两个元素逆序。 global降序:任意两个元素逆序。 若该数组local降序数=global降序数,则返回true, 反之返回false。 Example 1: Input: A = [1,0,2] Output: true 阅读全文
posted @ 2020-05-09 13:52 habibah_chang 阅读(90) 评论(0) 推荐(0) 编辑
摘要: 问题: 给一个数组(这一题可以有重复的数字),我们将其最多分成几块,各自进行全排序,能得到整体有序的数列? 数值大小范围增大,元素个数增多 Example 1: Input: arr = [5,4,3,2,1] Output: 1 Explanation: Splitting into two or 阅读全文
posted @ 2020-05-06 15:18 habibah_chang 阅读(92) 评论(0) 推荐(0) 编辑
摘要: 问题: 给一个[0~size()-1]排列的一个数组,我们将其最多分成几块,各自进行全排序,能得到整体有序的数列? Example 1: Input: arr = [4,3,2,1,0] Output: 1 Explanation: Splitting into two or more chunks 阅读全文
posted @ 2020-05-06 14:26 habibah_chang 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定一个二维数组, 若该数组的所有\方向的对角线数值相同,则为Toeplitz矩阵,返回true,否则返回false Example 1: Input: matrix = [ [1,2,3,4], [5,1,2,3], [9,5,1,2] ] Output: True Explanation 阅读全文
posted @ 2020-05-06 13:55 habibah_chang 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定数组,若存在最大值是任意其他元素的2倍以上,则返回该最大值的index,否则返回-1 Example 1: Input: nums = [3, 6, 1, 0] Output: 1 Explanation: 6 is the largest integer, and for every 阅读全文
posted @ 2020-05-06 13:33 habibah_chang 阅读(91) 评论(0) 推荐(0) 编辑
摘要: 问题: 爬楼梯问题(经典动态规划DP问题) 给定每阶台阶的消耗数组,每次可以选择爬一阶或者两阶,求爬到顶楼的最小消耗。 Example 1: Input: cost = [10, 15, 20] Output: 15 Explanation: Cheapest is start on cost[1] 阅读全文
posted @ 2020-05-05 15:33 habibah_chang 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 问题: 求构造类Calendar,能够记录用户录入自己的日程,日程起止时间不能重合,重合则返回false。 Example 1: MyCalendar(); MyCalendar.book(10, 20); // returns true MyCalendar.book(15, 25); // re 阅读全文
posted @ 2020-05-05 15:06 habibah_chang 阅读(132) 评论(0) 推荐(0) 编辑
上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 44 下一页