From 64d8a2e388742eebe2b0efa347a58635e998fe32 Mon Sep 17 00:00:00 2001 From: Valentyn Kolesnikov Date: Thu, 29 Dec 2022 14:44:33 +0200 Subject: [PATCH] Improved task 416. --- .../g0401_0500/s0416_partition_equal_subset_sum/Solution.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/g0401_0500/s0416_partition_equal_subset_sum/Solution.java b/src/main/java/g0401_0500/s0416_partition_equal_subset_sum/Solution.java index a713d2f7b..16dc38e3d 100644 --- a/src/main/java/g0401_0500/s0416_partition_equal_subset_sum/Solution.java +++ b/src/main/java/g0401_0500/s0416_partition_equal_subset_sum/Solution.java @@ -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) {