2840. Check if Strings Can be Made Equal With Operations II
Problem Statement
You are given two strings s1
and s2
, both of length n
, consisting of lowercase English letters.
You can apply the following operation on any of the two strings any number of times:
Choose any two indices
i
andj
such thati < j
and the differencej - i
is even, then swap the two characters at those indices in the string.
Return true
if you can make the strings s1
and s2
equal, and false
otherwise.
Example 1:
Example 2:
Constraints:
n == s1.length == s2.length
1 <= n <= 105
s1
ands2
consist only of lowercase English letters.
Intuition
Links
https://leetcode.com/problems/check-if-strings-can-be-made-equal-with-operations-ii/
Video Links
Approach 1:
C++
Approach 2:
C++
Approach 3:
C++
Approach 4:
C++
Similar Problems
Last updated