Skip to content

isogram: "invert if" case not caught #88

Description

@tehsphinx
package isogram

import "unicode"

// IsIsogram takes a string as input and decides whether it's an isogram or not
func IsIsogram(s string) bool {
	m := make(map[rune]int, len(s))
	for _, r := range s {
		if unicode.Is(unicode.Letter, r) {
			if _, ok := m[unicode.ToLower(r)]; ok {
				return false
			}
			m[unicode.ToLower(r)]++
		}
	}
	return true
}

This should show a comment about inverting the if for happy path on the left.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions