[Swift]LeetCode1191.
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ Given an integer array? For example,if? Return the maximum sub-array sum in the modified array. Note that the length of the sub-array can be? As the answer can be very large,return the answer?modulo? ? Example 1: Input: arr = [1,2],k = 3 Output: 9 Example 2: Input: arr = [1,-2,1],k = 5 Output: 2 Example 3: Input: arr = [-1,-2],k = 7 Output: 0 ? Constraints:
给你一个整数数组? 首先,我们要对该数组进行修改,即把原数组?
然后,请你返回修改后的数组中的最大的子数组之和。 注意,子数组长度可以是? 由于?结果可能会很大,所以需要?模(mod)? ? 示例 1: 输入:arr = [1,k = 3 输出:9 示例 2: 输入:arr = [1,k = 5 输出:2 示例 3: 输入:arr = [-1,k = 7 输出:0 ? 提示:
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |