Beyond Big O

First unpaired event

First unpaired event

Easy

Your task

  • A log viewer receives event keys in arrival order.
  • Find the first key that appears exactly once after normalization.
  • Return that normalized key, or the empty string if no key occurs exactly once.

Required API

  • Solve
    func Solve(keys []string) string

Behavior

  • Normalize only ASCII A–Z to a–z.
  • Count every occurrence, even when repeats are far apart.
  • Return lowercase and preserve encounter order when choosing the first unique key.
  • Leave the input unchanged.
  • Separate calls must not share mutable state.
  • Use only the standard library.

Constraints

  • The input is already valid: 0–1,000 identifiers, each 1–64 ASCII characters long.
  • Allowed characters are letters, digits, underscores and hyphens: [A-Za-z0-9_-].
  • Do not add parsing, trimming or validation.

Examples

The runner calls your functions directly; you do not need to parse JSON.

Example 1 · empty

Arguments
keys
[]
Expected return
""
Test data
Input
[]
Expected output
""

Example 2 · one key

Arguments
keys
[
  "Ping"
]
Expected return
"ping"
Test data
Input
["Ping"]
Expected output
"ping"

Example 3 · normalized frequency

Arguments
keys
[
  "API",
  "api",
  "DB"
]
Expected return
"db"
Test data
Input
["API", "api", "DB"]
Expected output
"db"

Example 4 · none qualifies

Arguments
keys
[
  "x",
  "Y",
  "X",
  "y"
]
Expected return
""
Test data
Input
["x", "Y", "X", "y"]
Expected output
""

Related guides

Editor options
Typing preferences

Saved in this browser.

Restoring local drafts…