Skip to content

counts [terminology]

Terminology

Usage

  • Use counts for a mapping or collection of per-item counts.
  • Use cnt for one scalar count.
  • Keeping the plural form for the mapping prevents confusion between a frequency table and one frequency.
counts = Counter(s)
for i, ch in enumerate(s):
    if counts[ch] == 1:
        return i
return -1

See 387. First Unique Character in a String.