Problem Description 1 1 Array Call Array Good 2 2 1 Find Minimum Number Adjacent Swaps Nee Q43792526
![Problem Description- 1/1 You have an array A We call the array good if A[2-A[2+1] for all i Find the minimum number of adjace](https://media.cheggcdn.com/media/dad/dad62bda-f975-40d3-bc60-d96f8bbfffcf/phpdqe8RL.png)

Pleasecode in java
Problem Description- 1/1 You have an array A We call the array good if A[2-A[2+1] for all i Find the minimum number of adjacent swaps you need to make the array good or otum 1 its impossible to do so An adjacent swap consists of choosing two consecutive indices and swapping the valuen they hold. Array is 0 indexed. Function Description Complete the minSwaps function in the editor below. It has the following parameter(s): Name Type Description Parameters INTEGER ARRAY Alil denotes i-th element of the array The function must return an INTEGER denoting the min adjacent swaps required to make the array good.. Return Constraints • 1SNS2000 1S A[i]s 10^5 Input Format For Custom Testing The first line contains an integer, N, denoting the number of elements in A. Each line i of the N subsequent lines (where 0si< N) contains an integer describing Ai. Sample Cases Input Output Output Description We can swap indices (2,3). 2. We can’t make A[0] – A[1]. 2. 3. Array contains odd number of elements. -1 1. EN12N Show transcribed image text Problem Description- 1/1 You have an array A We call the array good if A[2-A[2+1] for all i Find the minimum number of adjacent swaps you need to make the array good or otum 1 its impossible to do so An adjacent swap consists of choosing two consecutive indices and swapping the valuen they hold. Array is 0 indexed. Function Description Complete the minSwaps function in the editor below. It has the following parameter(s): Name Type Description Parameters INTEGER ARRAY Alil denotes i-th element of the array The function must return an INTEGER denoting the min adjacent swaps required to make the array good.. Return Constraints • 1SNS2000 1S A[i]s 10^5
Input Format For Custom Testing The first line contains an integer, N, denoting the number of elements in A. Each line i of the N subsequent lines (where 0si
Expert Answer
Answer to Problem Description- 1/1 You have an array A We call the array good if A[2-A[2+1] for all i Find the minimum number of a…
OR