擅长:python、mysql、java
<p>时间复杂度</p>
<pre><code>def find_chars_order_n(value1,value2):
hsh = {}
resp = set() #Set is used to have unique Characters
if str(value1) and str(value2):
str1 = list(str(value1))
str2 = list(str(value2))
for elm in str2:
hsh[elm] = elm
for elm in str1:
if hsh[elm]:
resp.add(elm)
# resp = str1 & str2 #using set intersection
if resp:
return list(resp))
else:
return None
if __name__ == "__main__":
print(find_chars_order_n(1400,4011))
</code></pre>