Given a sorted integer array. We need to make array elements distinct by increasing values and keeping array sum minimum possible. We need to print the minimum possible sum as output.

**Input:**

The first line of the input contains a single integer **T** denoting the number of test cases. The first line of each test case contains** N. **followed by **N** separate integers. ** **

**Output**:

For each test caseprint the minimum possible sum.

**Constraints:**

1 ≤ T ≤ 100

2 ≤ N ≤ 10^4

1 ≤ A[i] ≤ 10^3

**Example**:

**Input:**

2

5

2 2 3 5 6

2

20 20

**Output:**

20

41

**Explanation **:

Test Case 1: We make the array as {2, 3, 4, 5, 6}. Sum becomes 2 + 3 + 4 + 5 + 6 = 20

Test Case2 : We make the array as {20, 21 } .sum = 41

Author: Nishant_Singh

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.

the_coder95 | 465 |

thanuvinu94 | 384 |

ShivayLamba | 256 |

adityasuman2025 | 249 |

PrakharBansal1 | 236 |

the_coder95 | 1691 |

RishabhTanwar1 | 1110 |

thanuvinu94 | 1060 |

samay_kam_hai | 724 |

themanhasnoname | 620 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4897 |

Quandray | 4547 |

Login to report an issue on this page.