<awangdev>416. Partition Equal Subset Sum_1.java
public boolean canPartition(int[] nums) {
        if (nums == null || nums.length < 2)  return false;
        int sum = 0;
        for (int num : nums) sum += num;
        if (sum % 2 != 0) return false;
        sum /= 2;
        
        boolean[] dp = new boolean[sum + 1];  
        dp[0] = true;
        for (int i = 0; i < nums.length; i++) {
            int num = nums[i];
            for (int j = sum; j >= num; j--) {
                dp[j] = dp[j] || dp[j - num];
            }
        }
        return dp[sum];
    }
public boolean var_0 ( int [ ] var_1 ) {
  if ( var_1 == null || var_1 . length < 2 ) return false ;
  int var_6 = 0 ;
  for ( int var_7 : var_1 ) var_6 += var_7 ;
  if ( var_6 % 2 != 0 ) return false ;
  var_6 /= 2 ;
  boolean [ ] var_10 = new boolean [ var_6 + 1 ] ;
  var_10 [ 0 ] = true ;
  for ( int var_11 = 0 ;
  var_11 < var_1 . length ;
  var_11 ++ ) {
    int var_7 = var_1 [ var_11 ] ;
    for ( int var_12 = var_6 ;
    var_12 >= var_7 ;
    var_12 -- ) {
      var_10 [ var_12 ] = var_10 [ var_12 ] || var_10 [ var_12 - var_7 ] ;
    }
  }
  return var_10 [ var_6 ] ;
}
