Chargement de l'exercice…
Sometimes you need to combine the characters from two strings and keep only the unique ones. Write longest, which takes strings s1 and s2, collects every character that appears in at least one of them, removes duplicates, and sorts the result in ascending order. Return the final characters as one string.
"aretheyhere", "yeartroptpar""aehoprty""loopingisfunbutdangerous", "lessdangerousthancoding""abcdefghilnoprstu""inmar", "gbea""abegimnr"def longest(s1: str, s2: str) -> str:
Connectez-vous pour voir l'historique des soumissions
Se connecterConnectez-vous pour utiliser le Mentor IA
Se connecterThey run when you press "Submit" — your whole solution is checked against them so you can't hard-code answers for the visible cases.