LeetCode --- 1013. Partition Array Into Three Parts With Equal Sum 解题报告
Posted 杨鑫newlfe
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LeetCode --- 1013. Partition Array Into Three Parts With Equal Sum 解题报告相关的知识,希望对你有一定的参考价值。
Given an array of integers arr
, return true
if we can partition the array into three non-empty parts with equal sums.
Formally, we can partition the array if we can find indexes i + 1 < j
with (arr[0] + arr[1] + ... + arr[i] == arr[i + 1] + arr[i + 2] + ... + arr[j - 1] == arr[j] + arr[j + 1] + ... + arr[arr.length - 1])
Example 1:
Input: arr = [0,2,1,-6,6,-7,9,1,2,0,1] Output: true Explanation: 0 + 2 + 1 = -6 + 6 - 7 + 9 + 1 = 2 + 0 + 1
Example 2:
Input: arr = [0,2,1,-6,6,7,9,-1,2,0,1] Output: false
Example 3:
Input: arr = [3,3,6,5,-2,2,5,1,-9,4] Output:
以上是关于LeetCode --- 1013. Partition Array Into Three Parts With Equal Sum 解题报告的主要内容,如果未能解决你的问题,请参考以下文章
LeetCode#1013-将数组分成和相等的三个部分-前缀和-双指针
LeetCode --- 1013. Partition Array Into Three Parts With Equal Sum 解题报告
LeetCode --- 1013. Partition Array Into Three Parts With Equal Sum 解题报告
leetcode_easy_array1013. Partition Array Into Three Parts With Equal Sum