Swap

0

0 votes
Very-Easy
Problem

Given an array A of N elements. Print Yes if you can make array in non-decreasing order by performing at most 1 swap else print No.

Input
First line contains T (number of test cases). First line of each test case contains N (number of elements in array). Next line contains N integers separated by a single space.

Constraints
1 <= T <= 100
1 <= N <= 105
1 <= Ai <= 109

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?