Swap Characters to Equalize Strings
You are given two lowercase alphabet strings s
and t
, both of them the same length. You can pick one character in s
and another in t
and swap them. Given you can make unlimited number of swaps, return whether it’s possible to make the two strings equal.
Constraints
n ≤ 100,000
wheren
is the length ofs
andt
https://binarysearch.com/problems/Swap-Characters-to-Equalize-Strings
Examples
Example 1
Input
- s =
ab
- t =
ba
Output
- answer =
True
Example 2
Input
- s =
aa
- t =
aa
Output
- answer =
True
Leave a comment