"A book to train programming skills to fight in the world" Python code answer example --1.1 Duplicate character string
import numpy as np
def isUniqueChars(str):
if len(str)>128:
return False
char_set = np.zeros((128))
for id in range(len(str)):
val = ord(str[id])
if char_set[val] == 1:
return False
char_set[val] = 1
return True
input_str = "sentence"
print(isUniqueChars(input_str))