buddy-strings-equal-case-duplicate-check

Status: IN

When `s == goal`, `buddyStrings` returns `True` only if `s` contains a duplicate character (`len(s) != len(set(s))`), because swapping two copies of the same character is the only valid "swap that produces the same string."

Source: entries/2026/06/06/buddy-strings-solution.md

JSON