Company: Publicis Sapient_27sept
Difficulty: medium
Minimum Swaps to Arrange Even Before Odd Problem Description You are given an array arr of n positive integers, indexed from 0 to n - 1 . In one move you may pick any two indices i and j and swap the elements stored at them. The two indices do not have to be adjacent, and every move costs exactly 1 . Your task is to rearrange the array so that every even element comes before every odd element . The order of the elements among the even ones does not matter, and neither does the order among the odd ones. Complete the function minSwaps(arr) , which returns the minimum number of moves needed to reach such an arrangement. Input Format Read from standard input. The first line contains an integer n , the number of elements in the array. Each of the next n lines contains one integer arr[i] , for 0 <= i < n , in order. (inferred -- the source shows the array only as a list; one value per line is assumed. Any whitespace between values is accepted by the provided code.) Output Format Print