Determine if a string has all unique characters: Difference between revisions
Determine if a string has all unique characters (view source)
Revision as of 03:22, 29 December 2019
, 4 years ago→Python :: Functional
(→Python :: Functional: Added a variant in terms of sorting and grouping) |
|||
Line 883:
if duplications:
dup = sorted(duplications, key=lambda kv: kv[1][0])[0]
return Just((dup[0], [x[0] for x in dup[1]
else:
return Nothing()
Line 899:
return repr(s) + ' (' + str(len(s)) + ')'
def showDuplicate(
return repr(c) + (
' (' + hex(ord(c)) + ') at ' + repr(ix)
|