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.

VivSisMMM | 164 |

d_Coder00 | 163 |

ajayjadhav35 | 153 |

Astikeysingh | 148 |

Sathvik Avasarala | 143 |

Pulkit__Sharma__ | 658 |

Anirban166 | 565 |

abducodes | 542 |

Sathvik Avasarala | 506 |

Found_me | 494 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4559 |

Login to report an issue on this page.