摘要: 问题: 给定数组,求给定区间中,出现次数>=threshold的元素值。 Example: MajorityChecker majorityChecker = new MajorityChecker([1,1,2,2,1,1]); majorityChecker.query(0,5,4); // r 阅读全文
posted @ 2020-05-31 16:55 habibah_chang 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定一个非减数组,求对其每个元素进行平方运算后,形成的非减数组。 Example 1: Input: [-4,-1,0,3,10] Output: [0,1,9,16,100] Example 2: Input: [-7,-3,2,3,11] Output: [4,9,9,49,121] N 阅读全文
posted @ 2020-05-31 13:16 habibah_chang 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定数组,求连续子数组之和能被K整除的,子数组个数。 Example 1: Input: A = [4,5,0,-2,-3,1], K = 5 Output: 7 Explanation: There are 7 subarrays with a sum divisible by K = 5 阅读全文
posted @ 2020-05-31 12:32 habibah_chang 阅读(145) 评论(0) 推荐(0) 编辑