Golang Accepted 3ms solution


  • 0
    S

    func isAnagram(s string, t string) bool {
    if len(s) != len(t) {
    return false
    }
    if len(s)==0{
    return true
    }
    var ar [54]int
    for i := 0; i < len(s); i++ {
    ar[s[i]-97]++
    ar[t[i]-70]++
    }
    for j:=0;j< 26;j++ {
    if ar[j] != ar[j+27] {
    return false
    }
    }
    return true
    }


Log in to reply
 

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