0 out of 464 challenges solved
Write a Python function `count_unequal_pairs(lst)` that takes a list of integers `lst` and returns the number of unordered pairs `(i, j)` where `i < j` and `lst[i] != lst[j]`. #### Example Usage ```python [main.nopy] print(count_unequal_pairs([1, 2, 1])) # Output: 2 print(count_unequal_pairs([1, 1, 1, 1])) # Output: 0 print(count_unequal_pairs([1, 2, 3, 4, 5])) # Output: 10 ``` #### Constraints - The input list will have at least two elements. - The elements of the list are integers.
def count_unequal_pairs(lst):
"""
Count the number of unordered pairs (i, j) where i < j and lst[i] != lst[j].
Args:
lst (list): A list of integers.
Returns:
int: The count of such pairs.
"""
# Initialize the count variable
count = 0
# Implement the logic to count the pairs
# Placeholder for the solution
return count