摘要: 问题: 给定原数组A,和操作数组queries 假设q=queries[i] 那么q的操作为:对A[q[1]]+=q[0] evensum为A的所有偶数元素之和,求每次操作后evensum的值,所组成的列表res Example 1: Input: A = [1,2,3,4], queries = 阅读全文
posted @ 2020-06-01 14:10 habibah_chang 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 问题: 给两个由[1~6]之间的数字构成的两个数组A,B 若对其中一个数组中的一些元素用另一个数组同样index的元素替换,使得这个数组的所有元素都相同, 求最小替换个数。 Example 1: Input: A = [2,1,2,4,2,2], B = [5,2,6,2,3,2] Output: 阅读全文
posted @ 2020-06-01 13:34 habibah_chang 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定数组,求满足锯齿形子数组<连续两两元素的增减关系为:增减依次循环出现>的最大长度。 Example 1: Input: [9,4,2,10,7,8,8,1,9] Output: 5 Explanation: (A[1] > A[2] < A[3] > A[4] < A[5]) Examp 阅读全文
posted @ 2020-06-01 12:20 habibah_chang 阅读(89) 评论(0) 推荐(0) 编辑