Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Vote For New Content
Insufficient tests

hassan.javeed84

Feb 23, 2024

This code passes all the tests however it's wrong as in case of s = "hel" and t = "hll" it returns True

class Solution: def isAnagram(self, s, t): # TODO: Write your code here if len(s) != len(t): return False l = list(s) for c in t: if c not in l: return False return True

0

0

Comments
Comments
Shubham Vora
Shubham Voraa year ago

In the above code, you are not matching the freuency of characters. You are just checking whether any character of string t existsi in the string s.