Given a set of numbers, check whether it can be partitioned into two subsets such that the sum of elements in both subsets is same or not.

**Input:**

The first line contains an integer '**T**' denoting the total number of test cases. Each test case constitutes of two lines. First line contains '**N**', representing the number of elements in the set and the second line contains the elements of the set.

**Output: **

Print **YES** if the given set can be partioned** **into two subsets such that the sum of elements in both subsets is equal, else print **NO**.

**Constraints: **

1 <= T <= 100

1 <= N <= 100

0 <= arr[i] <= 1000

**Example:
Input:**

2

4

1 5 11 5

3

1 3 5

**Output:**

YES

NO

**Explanation:
Testcase 1:** There exists two subsets such that {1, 5, 5} and {11}.

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

thanuvinu94 | 292 |

the_coder95 | 258 |

ShivayLamba | 256 |

Ashish Kumar Vaishy | 170 |

adityasuman2025 | 144 |

the_coder95 | 1484 |

RishabhTanwar1 | 1110 |

thanuvinu94 | 968 |

samay_kam_hai | 668 |

themanhasnoname | 620 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4897 |

Quandray | 4547 |

Login to report an issue on this page.