Question: def anagramSolution4(s1,s2): c1 = [0]*26 c2 = [0]*26 for i in range(len(s1)): pos = ord(s1[i])-ord('a') c1[pos] = c1[pos] + 1 for i in range(len(s2)): pos
def anagramSolution4(s1,s2): c1 = [0]*26 c2 = [0]*26
for i in range(len(s1)): pos = ord(s1[i])-ord('a') c1[pos] = c1[pos] + 1
for i in range(len(s2)): pos = ord(s2[i])-ord('a') c2[pos] = c2[pos] + 1
j = 0 stillOK = True while j<26 and stillok: if c1[j]==c2[j]: j = j + 1 else: stillok = False
return stillOK
include all operations and calculate the Big-O and the values for c and n0.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
