Skip to content

Commit f0ff9fe

Browse files
authored
Create 3432. Count Partitions with Even Sum Difference (#950)
2 parents 48104a6 + 532c0d5 commit f0ff9fe

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Solution {
2+
public:
3+
int countPartitions(vector<int>& nums) {
4+
int sum = 0;
5+
for(int i = 0; i < nums.size(); i++) sum += nums[i];
6+
if(sum % 2 == 0) return nums.size() - 1;
7+
return 0;
8+
}
9+
};

0 commit comments

Comments
 (0)