JOSWAP - Just One Swap
You are given an array of size N. How many distinct arrays can you generate by swapping two numbers for exactly once? The two selected numbers can be equal but their positions in the array must be different.
The first line of the input contains a single integer T, denoting the number of test cases. Every test case starts with an integer N. The next line contains N integers, the numbers of the array.
For each tescase output the answer in a single line.
2 3 2 3 3
For Case :
what should be the answer for -
Bertho Coder can u check my solution?
simple combinations Ac in 1 go..
Basic combinatorial logic gives the answer. Use long long.
Last edit: 2017-04-08 18:06:44
Are the test cases surely correct?