O51

Partition Equal Subset Sum

Mid / Senior Engineer
Target Time: 25 - 35 Minutes
Type: BOOLEAN

Problem Statement & Objective

Given an integer array nums, return True if you can partition the array into two subsets such that the sum of the elements in both subsets is equal.

Function Signature (Python)

partition_equal_subset_sum(nums: list[int]) -> bool

Input & Output Contract

Output Rule:True veya False.

System Constraints

1 <= sayilar.length <= 200
1 <= sayilar[i] <= 100

Example Execution Walkthrough

sayilar = [1, 5, 11, 5] -> toplam 22 -> {11} ve {1, 5, 5} toplamları 11 -> True
sayilar = [1, 2, 3, 5] -> toplam 11 (tek sayı) -> bölünemez -> False

Example Test Scenarios (3)

Example 1: Eşit Bölünür
Input:[[1,5,11,5]]
Expected Output:true
Example 2: Tek Toplam
Input:[[1,2,3,5]]
Expected Output:false
Example 3: Çift Toplam Ama Bölünemez
Input:[[1,2,5]]
Expected Output:false
Loading Python Editor...
Input Parameters
[
  [
    1,
    5,
    11,
    5
  ]
]
Expected Output
true