Given an array with exactly 5 strings `"a"`, `"b"` or `"c"` (`char`s in Java, `character`s in Fortran), check if the array contains three and two of the same values.

## Examples

```
["a", "a", "a", "b", "b"] ==> true  // 3x "a" and 2x "b"
["a", "b", "c", "b", "c"] ==> false // 1x "a", 2x "b" and 2x "c"
["a", "a", "a", "a", "a"] ==> false // 5x "a"
```

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Data structures

Starter code: def check_three_and_two(array):
	

Solutions:
def check_three_and_two(array):
	return {array.count(x) for x in set(array)} == {2, 3}


def check_three_and_two(array):
	return True if len(set(array)) == 2 and [each for each in set(array) if array.count(each) in [2, 3]] else False


from collections import Counter

def check_three_and_two(array):
	return sorted(Counter(array).values()) == [2, 3]


def check_three_and_two(array):
	return {array.count(i) for i in array} == {2, 3}


def check_three_and_two(array):
	return sum([array.count(x) for x in array]) == 13


def check_three_and_two(array):
	return len(set(array)) == 2 and array.count(array[0]) not in [1, 4]


from collections import Counter
from typing import List

def check_three_and_two(array: List[str]) -> bool:
	return set(Counter(array).values()) == {2, 3}


def check_three_and_two(array):
	ans = [array.count(i) for i in 'abc']
	return True if 2 in ans and 3 in ans else False


def check_three_and_two(array):
	return max([array.count(a) for a in array]) == 3 and min([array.count(a) for a in array]) == 2


def check_three_and_two(arr):
	for i in arr:
		if not 2 <= arr.count(i) <= 3:
			return False
	return True