def is_permutation(str1, str2):
    """Check if str is permutation of another str
        Runtime: O(N)
    """
    if not isinstance(str1, str) or not isinstance(str2, str):
        return False
    if len(str1) != len(str2):
        return False
    if len(str1) < 1:
        return False

    count1 = {}
    count2 = {}
    for c in str1:
        if c in count1:
            count1[c] += 1
        else:
            count1[c] = 1
    for c in str2:
        if c in count2:
            count2[c] += 1
        else:
            count2[c] = 1
    if count1 != count2:
        return False
    return True