Pairing
ABC 378Problem 38 of 50
EasyWhat to do
You have four balls, each with a color represented by a number. Your goal is to find out how many pairs of balls you can remove if you can only remove two balls of the same color at a time.
Key Concepts
arrays or lists
counting
basic math
loops
Examples
Input:
[2, 1, 2, 1]
Output:
2
Input:
[4, 4, 4, 1]
Output:
1
Tips for Beginners
- Focus on understanding the logic, not memorizing syntax
- Use print statements to debug your code
- Don't worry about input parsing - the function handles that for you
- If stuck, try writing out your solution on paper first
Python Editor
Loading Python...