This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def isUnique(str): | |
str = heapsort(str) | |
for i, char in enumerate(str[:-1]): | |
if char == str[i+1]: | |
return False | |
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def isUnique(str): | |
if(len(str) > 26): | |
return False | |
hash = {} | |
for char in str: | |
if char in hash: | |
return False | |
else: | |
hash[char] = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def isUnique(str): | |
for i, char1 in enumerate(str): | |
for j, char2 in enumerate(str): | |
if char1 == char2 and i != j: | |
return False | |
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sequence_Length = 80 | |
Step_Size = 4 | |
sentences = [] | |
next_chars = [] | |
for i in range(0, len(text) - Sequence_Length, Step_Size): | |
sentences.append(text[i: i + Sequence_Length]) | |
next_chars.append(text[i + Sequence_Length]) |