Skip to content

seen [terminology]

Terminology

Usage

  • Use for values, states, keys, or remainders encountered before.
  • It commonly supports:
    • Duplicate detection
    • Cycle detection in generated states
    • Recurring-decimal detection
    • Value-to-position lookup
  • It does not necessarily imply that a graph node has been fully processed.
seen = set()

for x in nums:
    if x in seen:
        return True
    seen.add(x)