<h3><a title="题目描述" href="https://leetcode-cn.com/problems/partition-array-into-three-parts-with-equal-sum/">题目描述</a></h3>
![image.png](https://i.loli.net/2020/06/01/2uNoErIvAszx5tX.png)
<h4>方法一</h4>
<pre class="EnlighterJSRAW" data-enlighter-language="python">class Solution:
def canThreePartsEqualSum(self, A: List[int]) -> bool:
sum_num = sum(A)
if(sum_num %3 != 0):
return False
target_num = sum_num // 3
cnt, i, n = 0, 0, len(A)
while(i < n):
cnt += A[i]
if(cnt == target_num):
break
i += 1
if(cnt!=target_num):
return False
j = i + 1
while(j + 1 < n):#满足最后一个数组不能为空 否则则为2个数组
cnt += A[j]
if cnt == target_num *2:
return True
j += 1
return False
</pre>
<p> </p>
### Note:
- 审题 做的时候误以为可以随机划分 (即数的顺序可能有所调整,实际上是固定的,只需切几刀划分好数组即可,不必打乱数组)
Leetcode1013 将数组分成和相等的三个部分