Follow

challenge was to write a function that takes a string as an input and returns true if all the characters in the string are unique, and false otherwise.

Roast my attempt, but not too hard I just started.

@pope_meat
I'm no python expert, but you start by filling X with the sorted set of characters. Then duplicates will be next to eachother. So you could use a loop comparing two neighbors, stopping when two neighbors are equal.
(It's a very common pattern, for finding duplicates: sort, and compare neighbors)
Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.