{"size": 867, "ext": "js", "max_stars_repo_path": "Easy/valid-anagram.js", "max_stars_repo_name": "AonanHe/LeetCode", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Easy/valid-anagram.js", "max_issues_repo_name": "AonanHe/LeetCode", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Easy/valid-anagram.js", "max_forks_repo_name": "AonanHe/LeetCode", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 20.6428571429, "max_line_length": 42, "alphanum_fraction": 0.4083044983}
/**
 * Problem: Valid Anagram
 * Difficulty: Easy
 * Runtime: 72 ms
 * Date: 2018/05/12
 * Author: Aonan He
 */

/**
 * @param {string} s
 * @param {string} t
 * @return {boolean}
 */
var isAnagram = function(s, t) {
    const dictS = []
    const dictT = []
    for (let i = 0; i < s.length; i++) {
        if (dictS[s[i]] === undefined) {
            dictS[s[i]] = 0
        } else {
            dictS[s[i]] ++
        }
    }
    for (let i = 0; i < t.length; i++) {
        if (dictT[t[i]] === undefined) {
            dictT[t[i]] = 0
        } else {
            dictT[t[i]] ++
        }
    }
    for (let i = 0; i < s.length; i++) {
        if (dictS[s[i]] !== dictT[s[i]]) {
            return false
        }
    }
    for (let i = 0; i < t.length; i++) {
        if (dictS[t[i]] !== dictT[t[i]]) {
            return false
        }
    }
    return true
};