@@ -0,0 +1,1863 @@
+%22%22%22Codewars: Find The Parity Outlier%0A6 kyu%0A%0AURL: https://www.codewars.com/kata/5526fc09a1bbd946250002dc%0A%0AYou are given an array (which will have a length of at least 3,%0Abut could be very large) containing integers.%0AThe array is either entirely comprised of odd integers or %0Aentirely comprised of even integers except for a single integer N.%0AWrite a method that takes the array as an argument and returns this %22outlier%22 N.%0A%0AExamples%0A%5B2, 4, 0, 100, 4, 11, 2602, 36%5D%0AShould return: 11 (the only odd number)%0A%0A%5B160, 3, 1719, 19, 11, 13, -21%5D%0AShould return: 160 (the only even number)%0A%22%22%22%0A%0Adef find_outlier_naive(integers):%0A    # Iterate through integers to get number of evens.%0A    n_even = 0%0A    for i in range(len(integers)):%0A        if integers%5Bi%5D %25 2 == 0:%0A            n_even += 1%0A%0A    # Obtain outlier is odd or even.%0A    if n_even %3E 1:%0A        outlier = 1%0A    else:%0A        outlier = 0%0A    %0A    for i in range(len(integers)):%0A        if outlier == integers%5Bi%5D %25 2:%0A            return integers%5Bi%5D%0A%0A%0Adef find_outlier(integers):%0A    # Collect evens and odds.%0A    evens = %5Bi for i in integers if i %25 2 == 0%5D%0A    odds = list(set(integers) - set(evens))%0A%0A    # If the number of events is one or not, then we get outlier.%0A    if len(evens) == 1:%0A        return evens%5B0%5D%0A    else:%0A        return odds%5B0%5D%0A%0A%0Adef main():%0A    # Output: 11.%0A    integers = %5B2, 4, 0, 100, 4, 11, 2602, 36%5D%0A    print find_outlier(integers)%0A%0A    # Output: 160%0A    integers = %5B160, 3, 1719, 19, 11, 13, -21%5D%0A    print find_outlier(integers)%0A%0A    # Output: 2175970%0A    integers = %5B-7647303, -2670293, 9861423, -8134069, 9044429, -6477399, -7649341, 7689623, 6303953, 1239087, 5674661, 6572153, 2175970, -2144529, 7551097, -7069623, -4450133, 7611367, 632637, -1456711, 7081059, 7833561, -7208763, 8089047, 6067831, -231225%5D%0A    print find_outlier(integers)%0A%0A%0Aif __name__ == '__main__':%0A    main()%0A

Add cw_find_the_parity_outlier.py