Programmers / Pokemon
Problem
- Link
- Description
- Identify the types of Pokemon
- Type
- Set Usage
Solution 1
| |
- Description
- Use Set to check the number of Pokemon types
- If the number of Pokemon types is greater than or equal to half of the total Pokemon count, return half of the total count
- If the number of Pokemon types is less than or equal to half of the total Pokemon count, return the number of Pokemon types
- Time Complexity
- O(len(nums))
- Operations proportional to nums length
- Space Complexity
- O(1)
- Function parameters and local variables