Test Cases are not good.

  • 1
    bool isAnagram(string s, string t) {
            int l1=s.size();
            int l2=t.size();
            if(l2!=l1)return 0;
            int s1=0,t1=0;
            for(int i=0;i<l1;i++){
            if(s1==t1)return 1;
            return 0;

    This code is accepted for all test cases in leetcode.
    But it gives valid anagram for "aa" "bb", as well.

  • 0

    Did that really still get accepted yesterday? It also fails the test case "xaaddy","xbbccy", which was added a week ago already...

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.