Given an** N **bit binary number, find the 1's complement of the number. The ones' complement of a binary number is defined as the value obtained by inverting all the bits in the binary representation of the number (swapping 0s for 1s and vice versa).

**Input:**

The first line of input takes an integer **T,** the number of test cases. Then T test cases follow. The first line of each test case takes an integer **N,** the number of bits. The second line of each test case takes **N space separated** integers denoting the N bits of the binary number.

**Output:**

Print the 1's complement for each test case in a new line.

**Constraints:**

1<=T<=100

1<=N<=100

**Example:
Input:**

3

2

1 0

2

1 1

3

1 0 1

0 1

0 0 0 1 0

Author: akundusaltlake

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.

ShubhamJain18 | 205 |

makeitdonesolo | 140 |

lost_found | 124 |

maggiiiii | 118 |

SahatPrasad1 | 108 |

Bishnu Dev Panda | 777 |

okayboss | 551 |

ShubhamJain18 | 516 |

yk12 | 514 |

makeitdonesolo | 480 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4925 |

Quandray | 4547 |

Login to report an issue on this page.