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.

Akkki111 | 38 |

SaltBaeSama | 34 |

ambercyrus | 33 |

LegendFire | 32 |

chocozz | 32 |

KshatriyaYash | 1932 |

nikhil_sojan | 1374 |

lonecoder | 1219 |

mazumderrohit8 | 1095 |

SumitSingh27 | 1090 |

blackshadows | 5327 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4566 |

Quandray | 4444 |

Login to report an issue on this page.