Skip to content

Commit

Permalink
Improved task 416.
Browse files Browse the repository at this point in the history
  • Loading branch information
javadev authored Dec 29, 2022
1 parent 64e2bfa commit 64d8a2e
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ public boolean canPartition(int[] nums) {
for (int num : nums) {
sums += num;
}
// odd
if ((sums % 2) == 1) {
if (sums % 2 == 1) {
return false;
}
sums /= 2;
int n = nums.length;
boolean[] dp = new boolean[sums + 1];
dp[0] = true;
for (int num : nums) {
Expand Down

0 comments on commit 64d8a2e

Please sign in to comment.