Second largest distinct value

Write codeEasy12 min

Your task

Given a list of integers nums, return the second largest distinct value. If there is no second distinct value (the list is empty or every element is equal), return None. Example: [3, 1, 3, 2] has distinct values {1,2,3}, so the answer is 2.

Examples

second_largest(nums: list[int]) -> int | None
Example 1
Inputsecond_largest([3, 1, 3, 2])
Output2