上一页 1 ··· 30 31 32 33 34 35 36 37 38 ··· 44 下一页
摘要: 问题: 求给定数组的对称轴index。(其左边元素之和=右边元素之和) 若不存在则返回-1,若存在多个,返回最左边的对称轴。 Example 1: Input: nums = [1, 7, 3, 6, 5, 6] Output: 3 Explanation: The sum of the numbe 阅读全文
posted @ 2020-05-05 13:00 habibah_chang 阅读(128) 评论(0) 推荐(0)
摘要: 问题: 求给定数组中两两元素之差,从小到大第k个差是多少 Example 1: Input: nums = [1,3,1] k = 1 Output: 0 Explanation: Here are all the pairs: (1,3) -> 2 (1,1) -> 0 (3,1) -> 2 Th 阅读全文
posted @ 2020-05-04 14:31 habibah_chang 阅读(116) 评论(0) 推荐(0)
摘要: 问题: 给定两个数组,求两个数组中最长公共子数组的长度。 Example 1: Input: A: [1,2,3,2,1] B: [3,2,1,4,7] Output: 3 Explanation: The repeated subarray with maximum length is [3, 2 阅读全文
posted @ 2020-05-04 12:43 habibah_chang 阅读(177) 评论(0) 推荐(0)
摘要: 问题: 解码问题,给出一串0,1数列, 遇到1,则由10或11解码为一个字符。 否则遇到0,则单独0解码为一个字符。求解码到最后一个字符是否由0解码而来。 (给出数列,总是以0为结尾) Example 1: Input: bits = [1, 0, 0] Output: True Explanati 阅读全文
posted @ 2020-05-04 11:30 habibah_chang 阅读(125) 评论(0) 推荐(0)
摘要: 问题: 橘子催熟问题,0:空地,1:新鲜橘子,2:成熟橘子 每一分钟成熟橘子会催熟四周的新鲜橘子,但如果新鲜橘子四周空着,则不会被催熟。 求给定数组情况,最多需要多久催熟所有的橘子,如果无法催熟所有则返回-1。 Example 1: Input: [[2,1,1],[1,1,0],[0,1,1]] 阅读全文
posted @ 2020-04-29 19:10 habibah_chang 阅读(184) 评论(0) 推荐(0)
摘要: 问题: 给定数组0代表海水,1代表陆地,若陆地上下左右皆为海水,那么则称该陆地为一小岛。 求给定数组中有多少小岛。 Example 1: Input: 11110 11010 11000 00000 Output: 1 Example 2: Input: 11000 11000 00100 0001 阅读全文
posted @ 2020-04-29 15:53 habibah_chang 阅读(121) 评论(0) 推荐(0)
摘要: 问题: 买股票问题,给出一个数组,表示某个股票在每一天的价格, 买家可以在一天买入,在之后的一天卖出,一次交易会产生交易费fee,求最大获利。 Example 1: Input: prices = [1, 3, 2, 8, 4, 9], fee = 2 Output: 8 Explanation: 阅读全文
posted @ 2020-04-26 15:31 habibah_chang 阅读(123) 评论(0) 推荐(0)
摘要: 问题: 求给定数组的连续子数组个数,使得子数组之乘积,小于给定值 k Example 1: Input: nums = [10, 5, 2, 6], k = 100 Output: 8 Explanation: The 8 subarrays that have product less than 阅读全文
posted @ 2020-04-24 18:29 habibah_chang 阅读(154) 评论(0) 推荐(0)
摘要: 问题: 给定一个非负整数,求只交换一次某两位的数字,使得值最大,求该最大值。 Example 1: Input: 2736 Output: 7236 Explanation: Swap the number 2 and the number 7. Example 2: Input: 9973 Out 阅读全文
posted @ 2020-04-21 14:24 habibah_chang 阅读(106) 评论(0) 推荐(0)
摘要: 问题: 给定StartWord和EndWord,在给定的dict中寻找每次值变换一个字母,最终从StartWord能够推移到EndWord的所有最短序列。 Example 1: Input: beginWord = "hit", endWord = "cog", wordList = ["hot", 阅读全文
posted @ 2020-04-21 13:11 habibah_chang 阅读(167) 评论(0) 推荐(0)
上一页 1 ··· 30 31 32 33 34 35 36 37 38 ··· 44 下一页