16 lines
603 B
Python
16 lines
603 B
Python
# HumanEval/158
|
|
# Loki Mode Multi-Agent Solution
|
|
# Attempts: 1
|
|
# Passed: True
|
|
|
|
def find_max(words):
|
|
"""Write a function that accepts a list of strings.
|
|
The list contains different words. Return the word with maximum number
|
|
of unique characters. If multiple strings have maximum number of unique
|
|
characters, return the one which comes first in lexicographical order.
|
|
|
|
find_max(["name", "of", "string"]) == "string"
|
|
find_max(["name", "enam", "game"]) == "enam"
|
|
find_max(["aaaaaaa", "bb" ,"cc"]) == ""aaaaaaa"
|
|
"""
|
|
return sorted(words, key=lambda w: (-len(set(w)), w))[0] |